From effb5786da04e28effadc0602ef1ec5465458801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 22 Mar 2009 15:51:37 +0100 Subject: mxfmux: Fix some memory leaks, improve debugging and handle errors better --- gst/mxf/mxfjpeg2000.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gst/mxf/mxfjpeg2000.c') diff --git a/gst/mxf/mxfjpeg2000.c b/gst/mxf/mxfjpeg2000.c index 9ff13f70..1f76d76a 100644 --- a/gst/mxf/mxfjpeg2000.c +++ b/gst/mxf/mxfjpeg2000.c @@ -232,11 +232,11 @@ mxf_jpeg2000_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps, guint32 fourcc; s = gst_caps_get_structure (caps, 0); - if (strcmp (gst_structure_get_name (s), "image/x-jpc") != 0) - return NULL; - - if (!gst_structure_get_fourcc (s, "fourcc", &fourcc)) + if (strcmp (gst_structure_get_name (s), "image/x-jpc") != 0 || + !gst_structure_get_fourcc (s, "fourcc", &fourcc)) { + GST_ERROR ("Invalid caps %" GST_PTR_FORMAT, caps); return NULL; + } ret = (MXFMetadataRGBAPictureEssenceDescriptor *) gst_mini_object_new (MXF_TYPE_METADATA_RGBA_PICTURE_ESSENCE_DESCRIPTOR); @@ -268,8 +268,12 @@ mxf_jpeg2000_get_descriptor (GstPadTemplate * tmpl, GstCaps * caps, g_assert_not_reached (); } - mxf_metadata_generic_picture_essence_descriptor_from_caps (&ret->parent, - caps); + if (!mxf_metadata_generic_picture_essence_descriptor_from_caps (&ret->parent, + caps)) { + gst_mini_object_unref (GST_MINI_OBJECT_CAST (ret)); + return NULL; + } + *handler = mxf_jpeg2000_write_func; return (MXFMetadataFileDescriptor *) ret; -- cgit v1.2.1