aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/glx
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-07-22 09:39:04 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-07-22 09:39:04 +0200
commit0e3ce759694f55f030418e47c523940efb9ff00d (patch)
tree1b1964b160e8803352a88dcbe74696a348facfa5 /src/api/glx
parent8577a25d21435952ac7cf3597530217bce2f1cb5 (diff)
parent65d56e55216beed99f4bb81eddaffa8bafbdb33e (diff)
downloadglutin-0e3ce759694f55f030418e47c523940efb9ff00d.tar.gz
glutin-0e3ce759694f55f030418e47c523940efb9ff00d.zip
Merge pull request #536 from tomaka/fix-using-freed-memory
Fix calling XFree before reading from memory
Diffstat (limited to 'src/api/glx')
-rw-r--r--src/api/glx/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs
index 65819f8..f640bee 100644
--- a/src/api/glx/mod.rs
+++ b/src/api/glx/mod.rs
@@ -340,13 +340,14 @@ fn create_context(glx: &ffi::glx::Glx, extra_functions: &ffi::glx_extra::Glx, ex
unsafe fn enumerate_configs(glx: &ffi::glx::Glx, xlib: &ffi::Xlib, display: *mut ffi::Display)
-> Result<Vec<(ffi::glx::types::GLXFBConfig, PixelFormat)>, CreationError>
{
- let configs = {
+ let configs: Vec<ffi::glx::types::GLXFBConfig> = {
let mut num_configs = 0;
let vals = glx.GetFBConfigs(display as *mut _, 0, &mut num_configs); // TODO: screen number
assert!(!vals.is_null());
let configs = slice::from_raw_parts(vals, num_configs as usize);
+ let ret = configs.to_vec();
(xlib.XFree)(vals as *mut _);
- configs.to_vec()
+ ret
};
let get_attrib = |attrib: libc::c_int, fb_config: ffi::glx::types::GLXFBConfig| -> i32 {