From b2c8b23c51c7d86f9f8e1bd269df326261443ee2 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Mon, 14 Jan 2019 15:06:26 +0900 Subject: [PATCH] nleoperation: Fix GstPad leak Returned GstPad by nle_object_remove_ghost_pad() has increased refcount. --- plugins/nle/nleoperation.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/nle/nleoperation.c b/plugins/nle/nleoperation.c index d7cba520d0..5a9801b4fd 100644 --- a/plugins/nle/nleoperation.c +++ b/plugins/nle/nleoperation.c @@ -664,6 +664,7 @@ static gboolean remove_sink_pad (NleOperation * operation, GstPad * sinkpad) { gboolean ret = TRUE; + gboolean need_unref = FALSE; GST_DEBUG ("sinkpad %s:%s", GST_DEBUG_PAD_NAME (sinkpad)); @@ -679,6 +680,7 @@ remove_sink_pad (NleOperation * operation, GstPad * sinkpad) ret = FALSE; goto beach; } + need_unref = TRUE; } if (sinkpad) { @@ -693,6 +695,8 @@ remove_sink_pad (NleOperation * operation, GstPad * sinkpad) } operation->sinks = g_list_remove (operation->sinks, sinkpad); nle_object_remove_ghost_pad ((NleObject *) operation, sinkpad); + if (need_unref) + gst_object_unref (sinkpad); operation->realsinks--; }