summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-06-01 10:05:32 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-06-01 10:10:20 +0100
commita565dbd1f32b6a9a87866e8ccc25017db516e62e (patch)
tree57bd3921de10a5790bbeaac0d544c58f0fd11da4
parentfc866b82dbd59f98b84f65ff4f1bbb6b7d054e35 (diff)
structures: don't leak invalid or empty strings when we warn
Fixes minor memory leak in unit tests caused by the recent changes. Since we're expected to take ownership of the GValue in the structure field struct here, we need to unset it if we don't use it.
-rw-r--r--gst/gststructure.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gst/gststructure.c b/gst/gststructure.c
index af1243a29b..a43b9e7a8c 100644
--- a/gst/gststructure.c
+++ b/gst/gststructure.c
@@ -655,18 +655,21 @@ gst_structure_set_field (GstStructure * structure, GstStructureField * field)
if (G_UNLIKELY (s == NULL && IS_TAGLIST (structure))) {
g_warning ("Trying to set NULL string on field '%s' on taglist. "
"Please file a bug.", g_quark_to_string (field->name));
+ g_value_unset (&field->value);
return;
} else if (G_UNLIKELY (s != NULL && *s == '\0')) {
/* empty strings never make sense */
g_warning ("Trying to set empty string on %s field '%s'. Please file a "
"bug.", IS_TAGLIST (structure) ? "taglist" : "structure",
g_quark_to_string (field->name));
+ g_value_unset (&field->value);
return;
} else if (G_UNLIKELY (s != NULL && !g_utf8_validate (s, -1, NULL))) {
g_warning ("Trying to set string on %s field '%s', but string is not "
"valid UTF-8. Please file a bug.",
IS_TAGLIST (structure) ? "taglist" : "structure",
g_quark_to_string (field->name));
+ g_value_unset (&field->value);
return;
}
}