diff --git a/subprojects/gstreamer/gst/gstpad.c b/subprojects/gstreamer/gst/gstpad.c index 4d4f2b3d96..06b4552f6f 100644 --- a/subprojects/gstreamer/gst/gstpad.c +++ b/subprojects/gstreamer/gst/gstpad.c @@ -6285,6 +6285,7 @@ gst_pad_start_task (GstPad * pad, GstTaskFunction func, gpointer user_data, task = GST_PAD_TASK (pad); if (task == NULL) { task = gst_task_new (func, user_data, notify); + notify = NULL; gst_task_set_lock (task, GST_PAD_GET_STREAM_LOCK (pad)); gst_task_set_enter_callback (task, pad_enter_thread, pad, NULL); gst_task_set_leave_callback (task, pad_leave_thread, pad, NULL); @@ -6306,6 +6307,10 @@ gst_pad_start_task (GstPad * pad, GstTaskFunction func, gpointer user_data, res = gst_task_set_state (task, GST_TASK_STARTED); GST_OBJECT_UNLOCK (pad); + /* free user_data if it wasn't used for gst_task_new */ + if (notify) + notify (user_data); + return res; /* ERRORS */