Fix temporary_cstring_as_ptr lint, using freed memory
This commit is contained in:
parent
297cfd0448
commit
e9d2e4691c
|
@ -6,7 +6,7 @@ jobs:
|
|||
displayName: "Install build dependencies"
|
||||
condition: eq(variables['Agent.OS'], 'Linux')
|
||||
minrust: 1.44.1
|
||||
clippy: -A clippy::temporary_cstring_as_ptr -A clippy::not_unsafe_ptr_arg_deref -A clippy::float_cmp
|
||||
clippy: -A clippy::not_unsafe_ptr_arg_deref -A clippy::float_cmp
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
|
|
|
@ -536,8 +536,9 @@ impl Program {
|
|||
}
|
||||
|
||||
pub fn uniform_location(&self, name: &str) -> Option<Uniform> {
|
||||
let c_name = ffi::CString::new(name).unwrap();
|
||||
let u =
|
||||
unsafe { gl::GetUniformLocation(self.0, ffi::CString::new(name).unwrap().as_ptr()) };
|
||||
unsafe { gl::GetUniformLocation(self.0, c_name.as_ptr()) };
|
||||
if u != -1 {
|
||||
Some(Uniform(u))
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue