*: fix UB with CString usage

This commit is contained in:
meh
2015-09-22 02:44:13 +02:00
parent 9ab5841b55
commit 2ca44d08d4
6 changed files with 53 additions and 20 deletions

View File

@ -54,7 +54,8 @@ pub fn license() -> &'static str {
pub fn find(name: &str) -> Option<Filter> {
unsafe {
let ptr = avfilter_get_by_name(CString::new(name).unwrap().as_ptr());
let name = CString::new(name).unwrap();
let ptr = avfilter_get_by_name(name.as_ptr());
if ptr.is_null() {
None