shm: Don't leak GstShmPipe

By reordering the leaking code path to before the allocation

CID #1212153
This commit is contained in:
Edward Hervey 2014-05-13 11:41:42 +02:00
parent 93ef3f9b24
commit b2e037b7de

View file

@ -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);