mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
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
1 changed files with 6 additions and 4 deletions
|
@ -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…
Reference in a new issue