gst/gstcaps.c: fix memleak

Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_subtract):
fix memleak
This commit is contained in:
Benjamin Otte 2004-04-25 17:46:30 +00:00
parent 68c0bc0177
commit 3d021d552f
2 changed files with 23 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2004-04-25 Benjamin Otte <otte@gnome.org>
* gst/gstcaps.c: (gst_caps_subtract):
fix memleak
2004-04-23 Benjamin Otte <otte@gnome.org>
* gst/gstvalue.c: (gst_value_compare_buffer),

View file

@ -945,6 +945,7 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
You can only remove everything or nothing and that is done above.
Note: there's a test that checks this behaviour. */
g_return_val_if_fail (!gst_caps_is_any (minuend), NULL);
g_assert (subtrahend->structs->len > 0);
src = gst_caps_copy (minuend);
for (i = 0; i < subtrahend->structs->len; i++) {
@ -977,6 +978,7 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
return dest;
}
gst_caps_free (src);
gst_caps_do_simplify (dest);
return dest;
}
@ -1180,12 +1182,23 @@ gst_caps_structure_simplify (GstStructure ** result,
gst_caps_structure_figure_out_union, &field)) {
gboolean ret = FALSE;
if (G_IS_VALUE (&field.value)) {
if (gst_structure_n_fields (simplify) == gst_structure_n_fields (compare)) {
gst_structure_id_set_value (compare, field.name, &field.value);
*result = NULL;
ret = TRUE;
}
g_value_unset (&field.value);
} else {
gchar *one = gst_structure_to_string (simplify);
gchar *two = gst_structure_to_string (compare);
GST_ERROR
("caps mismatch: structures %s and %s claim to be possible to unify, but aren't",
one, two);
g_free (one);
g_free (two);
}
return ret;
}