rtp: fix buffer leak when gst_rtp_buffer_map() fails because of broken data
authorTim-Philipp Müller <tim@centricular.net>
Wed, 22 Aug 2012 08:20:55 +0000 (09:20 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 22 Aug 2012 08:20:55 +0000 (09:20 +0100)
Makes libs/rtp unit test valgrind clean.

gst-libs/gst/rtp/gstrtpbuffer.c

index 86fc808..f6f8bcc 100644 (file)
@@ -443,7 +443,14 @@ wrong_padding:
   }
 dump_packet:
   {
+    gint i;
+
     GST_MEMDUMP ("buffer", data, size);
+
+    for (i = 0; i < G_N_ELEMENTS (rtp->map); ++i) {
+      if (rtp->data[i] != NULL)
+        gst_buffer_unmap (buffer, &rtp->map[i]);
+    }
     return FALSE;
   }
 }