Repository: brendanzab/gl-rs (language: rust)

Issue:
Logic error in example
https://github.com/bjz/gl-rs/blob/master/examples/static_triangle.rs#L67

`buf` doesn't get allocated



Discussion / hints:

Fix patch:
diff --git a/examples/static_triangle.rs b/examples/static_triangle.rs
index 3fb81734..52aa3b08 100644
--- a/examples/static_triangle.rs
+++ b/examples/static_triangle.rs
@@ -84,7 +84,7 @@ fn link_program(vs: GLuint, fs: GLuint) -> GLuint { unsafe {
     if status != (gl::TRUE as GLint) {
         let mut len: GLint = 0;
         gl::GetProgramiv(program, gl::INFO_LOG_LENGTH, &mut len);
-        let mut buf = Vec::new();
+        let mut buf = Vec::with_capacity(len as usize);
         buf.set_len((len as usize) - 1); // subtract 1 to skip the trailing null character
         gl::GetProgramInfoLog(program, len, ptr::null_mut(), buf.as_mut_ptr() as *mut GLchar);
         panic!("{}", str::from_utf8(buf.as_slice()).ok().expect("ProgramInfoLog not valid utf8"));


Test patch: