From b2e037b7de5a571c0aa1c4a287c5080051521889 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 13 May 2014 11:41:42 +0200 Subject: shm: Don't leak GstShmPipe By reordering the leaking code path to before the allocation CID #1212153 --- sys/shm/gstshmsrc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/shm/gstshmsrc.c b/sys/shm/gstshmsrc.c index d8ee560b4..8af1f34d1 100644 --- a/sys/shm/gstshmsrc.c +++ b/sys/shm/gstshmsrc.c @@ -214,10 +214,7 @@ gst_shm_src_get_property (GObject * object, guint prop_id, static gboolean gst_shm_src_start_reading (GstShmSrc * self) { - GstShmPipe *gstpipe = g_slice_new0 (GstShmPipe); - - gstpipe->use_count = 1; - gstpipe->src = gst_object_ref (self); + GstShmPipe *gstpipe; if (!self->socket_path) { GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND, @@ -225,6 +222,10 @@ gst_shm_src_start_reading (GstShmSrc * self) return FALSE; } + gstpipe = g_slice_new0 (GstShmPipe); + gstpipe->use_count = 1; + gstpipe->src = gst_object_ref (self); + GST_DEBUG_OBJECT (self, "Opening socket %s", self->socket_path); GST_OBJECT_LOCK (self); -- cgit v1.2.1