caps: 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.
This commit is contained in:
parent
d118ed3deb
commit
269699f621
@ -423,13 +423,15 @@ gst_static_caps_get (GstStaticCaps * static_caps)
|
||||
|
||||
*caps = gst_caps_from_string (string);
|
||||
|
||||
/* convert to string */
|
||||
if (G_UNLIKELY (*caps == NULL)) {
|
||||
g_critical ("Could not convert static caps \"%s\"", string);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Caps generated from static caps are usually leaked */
|
||||
GST_MINI_OBJECT_FLAG_SET (*caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
/* convert to string */
|
||||
if (G_UNLIKELY (*caps == NULL))
|
||||
g_critical ("Could not convert static caps \"%s\"", string);
|
||||
|
||||
GST_CAT_TRACE (GST_CAT_CAPS, "created %p from string %s", static_caps,
|
||||
string);
|
||||
done:
|
||||
|
Loading…
x
Reference in New Issue
Block a user