miniobject: don't modify memory if it's clearly not a valid miniobject

Add back function guard that checks the refcount in a read-only
operation first, and bail out without modifying the passed-in
memory if it's clearly not a valid mini object. Otherwise we
probably cause more harm than good. We keep the second sanity
check based on the 'real refcount' at the time of the unref
around for now too.

https://bugzilla.gnome.org/show_bug.cgi?id=784383
This commit is contained in:
Tim-Philipp Müller 2017-07-15 11:54:18 +01:00
parent b37429c995
commit ea62c96b94

View file

@ -429,6 +429,7 @@ gst_mini_object_unref (GstMiniObject * mini_object)
gint old_refcount, new_refcount;
g_return_if_fail (mini_object != NULL);
g_return_if_fail (GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0);
old_refcount = g_atomic_int_add (&mini_object->refcount, -1);
new_refcount = old_refcount - 1;