From b2bf8cc44ac2220620ccc2ec9ee0e6e31cd1644c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 17 Dec 2003 05:14:14 +0000 Subject: [PATCH] fix is_always_compatible to work with ANY caps (includes fix for memleak) Original commit message from CVS: fix is_always_compatible to work with ANY caps (includes fix for memleak) --- gst/gstcaps2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst/gstcaps2.c b/gst/gstcaps2.c index 16f9b8afc4..71bde9886f 100644 --- a/gst/gstcaps2.c +++ b/gst/gstcaps2.c @@ -389,6 +389,17 @@ gst_caps2_is_always_compatible (const GstCaps2 *caps1, const GstCaps2 *caps2) { int i; + g_return_val_if_fail (caps1 != NULL, FALSE); + g_return_val_if_fail (caps2 != NULL, FALSE); + /* FIXME: is this right ? */ + g_return_val_if_fail (!gst_caps2_is_empty (caps1), FALSE); + g_return_val_if_fail (!gst_caps2_is_empty (caps2), FALSE); + + if (gst_caps2_is_any (caps2)) + return TRUE; + if (gst_caps2_is_any (caps1)) + return FALSE; + for(i=0;istructs->len;i++) { GstStructure *struct1 = gst_caps2_get_nth_cap (caps1, i); @@ -676,6 +687,7 @@ static void _gst_caps2_value_free (GValue *value) static void _gst_caps2_value_copy (const GValue *src, GValue *dest) { + gst_caps2_free (dest->data[0].v_pointer); dest->data[0].v_pointer = gst_caps2_copy (src->data[0].v_pointer); }