diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2014-05-09 15:32:18 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2014-05-09 15:32:18 +0100 |
commit | 3f68f522eeab5e3b035b74597943b571ebeeefe0 (patch) | |
tree | fb735c4eb332da3e98e8576289e4278f7f6f8a6b /gst-libs | |
parent | 446f9bf6bd8fbfc1fd42e60c7872027fac398509 (diff) |
tag: xmp: fix leaks in error code paths
CID 1212133
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/tag/gstxmptag.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gst-libs/gst/tag/gstxmptag.c b/gst-libs/gst/tag/gstxmptag.c index 5f217dc57d..57c104d8c4 100644 --- a/gst-libs/gst/tag/gstxmptag.c +++ b/gst-libs/gst/tag/gstxmptag.c @@ -1181,7 +1181,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer) gchar *xps, *xp1, *xp2, *xpe, *ns, *ne; gsize len, max_ft_len; gboolean in_tag; - gchar *part, *pp; + gchar *part = NULL, *pp; guint i; XmpTag *last_xmp_tag = NULL; GSList *pending_tags = NULL; @@ -1249,7 +1249,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer) while (*xp1 != '<' && xp1 < xpe) xp1++; - /* no tag can be longer that the whole buffer */ + /* no tag can be longer than the whole buffer */ part = g_malloc (xp2 - xp1); list = gst_tag_list_new_empty (); @@ -1477,12 +1477,15 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer) GST_INFO ("xmp packet parsed, %d entries", gst_tag_list_n_tags (list)); +out: + /* free resources */ i = 0; while (ns_map[i].original_ns) { g_free (ns_map[i].gstreamer_ns); i++; } + g_free (part); gst_buffer_unmap (buffer, &info); @@ -1492,13 +1495,15 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer) /* Errors */ missing_header: GST_WARNING ("malformed xmp packet header"); - return NULL; + goto out; missing_footer: GST_WARNING ("malformed xmp packet footer"); - return NULL; + goto out; broken_xml: GST_WARNING ("malformed xml tag: %s", part); - return NULL; + gst_tag_list_unref (list); + list = NULL; + goto out; } |