From: Jan Schmidt Date: Mon, 2 Jan 2017 15:12:27 +0000 (+1100) Subject: padtemplate: Fix null pointer dereference on invalid static caps X-Git-Tag: 1.12.0~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=246618125f419a8a6cbb8f5534b151623e46828c;p=platform%2Fupstream%2Fgstreamer.git padtemplate: Fix null pointer dereference on invalid static caps A typo in a static caps string may result in failure to deserialise it, so don't dereference the result without checking. --- diff --git a/gst/gstpadtemplate.c b/gst/gstpadtemplate.c index 453c2d1..55ab892 100644 --- a/gst/gstpadtemplate.c +++ b/gst/gstpadtemplate.c @@ -415,9 +415,11 @@ gst_pad_template_set_property (GObject * object, guint prop_id, break; case PROP_CAPS: GST_PAD_TEMPLATE_CAPS (object) = g_value_dup_boxed (value); - /* GstPadTemplate are usually leaked so are their caps */ - GST_MINI_OBJECT_FLAG_SET (GST_PAD_TEMPLATE_CAPS (object), - GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED); + if (GST_PAD_TEMPLATE_CAPS (object) != NULL) { + /* GstPadTemplate are usually leaked so are their caps */ + GST_MINI_OBJECT_FLAG_SET (GST_PAD_TEMPLATE_CAPS (object), + GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED); + } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);