summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Bouron <matthieu.bouron@collabora.com>2013-10-23 15:56:20 +0100
committerSebastian Dröge <sebastian@centricular.com>2013-11-01 15:15:29 +0100
commita0e2eb61692c56edc84de378119c353d828bc577 (patch)
tree15dc6c8c85fdf09bb6455cdb8e93e1f7e3e44e12
parenta3431f5d8ba4419366e5bc570e2a7dc5b75ba49b (diff)
gst-launch: fix potential uninitialized variable warning
https://bugzilla.gnome.org/show_bug.cgi?id=710758
-rw-r--r--tools/gst-launch.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 13d3c02f7..b5f0438fd 100644
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -335,11 +335,13 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
count = gst_tag_list_get_tag_size (list, tag);
for (i = 0; i < count; i++) {
- gchar *str;
+ gchar *str = NULL;
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
- if (!gst_tag_list_get_string_index (list, tag, i, &str))
+ if (!gst_tag_list_get_string_index (list, tag, i, &str)) {
+ g_warning ("Couldn't fetch string for %s tag", tag);
g_assert_not_reached ();
+ }
} else if (gst_tag_get_type (tag) == GST_TYPE_SAMPLE) {
GstSample *sample = NULL;
@@ -362,6 +364,9 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
} else {
str = g_strdup ("NULL buffer");
}
+ } else {
+ g_warning ("Couldn't fetch sample for %s tag", tag);
+ g_assert_not_reached ();
}
} else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) {
GstDateTime *dt = NULL;
@@ -392,13 +397,10 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
- if (i == 0) {
- PRINT ("%16s: %s\n", gst_tag_get_nick (tag), str);
- } else {
- PRINT ("%16s: %s\n", "", str);
+ if (str) {
+ PRINT ("%16s: %s\n", i == 0 ? gst_tag_get_nick (tag) : "", str);
+ g_free (str);
}
-
- g_free (str);
}
}