tag: fix leak when parsing undefined EXIF tag into tag list
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 2 Nov 2010 12:01:03 +0000 (12:01 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 2 Nov 2010 12:02:23 +0000 (12:02 +0000)
gst_buffer_set_data() does not set GST_BUFFER_MALLOCDATA, but
the code assumes the buffer takes ownership of the memory
allocated earlier.

gst-libs/gst/tag/gstexiftag.c

index d73859b..e72bf3a 100644 (file)
@@ -1223,8 +1223,12 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag,
 
   tagtype = gst_tag_get_type (tag->gst_tag);
   if (tagtype == GST_TYPE_BUFFER) {
-    GstBuffer *buf = gst_buffer_new ();
-    gst_buffer_set_data (buf, data, count);
+    GstBuffer *buf;
+
+    buf = gst_buffer_new ();
+    GST_BUFFER_DATA (buf) = data;
+    GST_BUFFER_MALLOCDATA (buf) = data;
+    GST_BUFFER_SIZE (buf) = count;
     data = NULL;
 
     gst_tag_list_add (reader->taglist, GST_TAG_MERGE_APPEND, tag->gst_tag,