Fix memory leak for gst_video::convert_sample_async()

Values are passed owned to the callback
This commit is contained in:
Sebastian Dröge 2017-12-30 12:08:26 +02:00
parent 65468c1fc8
commit c52da3639a

View file

@ -12,7 +12,7 @@ use glib_ffi;
use gst; use gst;
use glib; use glib;
use glib::translate::{from_glib_full, from_glib_none, ToGlib, ToGlibPtr}; use glib::translate::{from_glib_full, ToGlib, ToGlibPtr};
use std::ptr; use std::ptr;
use std::mem; use std::mem;
@ -59,9 +59,9 @@ pub fn convert_sample_async<F>(
let callback = callback.take().unwrap(); let callback = callback.take().unwrap();
if error.is_null() { if error.is_null() {
callback(Ok(from_glib_none(sample))) callback(Ok(from_glib_full(sample)))
} else { } else {
callback(Err(from_glib_none(error))) callback(Err(from_glib_full(error)))
} }
} }
unsafe extern "C" fn convert_sample_async_free<F>(user_data: glib_ffi::gpointer) unsafe extern "C" fn convert_sample_async_free<F>(user_data: glib_ffi::gpointer)