flvmux: Don't leak codec_data buffer
authorSeungha Yang <seungha.yang@navercorp.com>
Thu, 20 Sep 2018 03:12:55 +0000 (12:12 +0900)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 20 Sep 2018 08:35:31 +0000 (11:35 +0300)
Use gst_buffer_replace() to prevent buffer leak

https://bugzilla.gnome.org/show_bug.cgi?id=797179

gst/flv/gstflvmux.c

index 584558c..6d0a140 100644 (file)
@@ -418,7 +418,7 @@ gst_flv_mux_video_pad_setcaps (GstFlvMuxPad * pad, GstCaps * caps)
     const GValue *val = gst_structure_get_value (s, "codec_data");
 
     if (val)
-      pad->codec_data = gst_buffer_ref (gst_value_get_buffer (val));
+      gst_buffer_replace (&pad->codec_data, gst_value_get_buffer (val));
   }
 
   gst_object_unref (mux);
@@ -559,7 +559,7 @@ gst_flv_mux_audio_pad_setcaps (GstFlvMuxPad * pad, GstCaps * caps)
     const GValue *val = gst_structure_get_value (s, "codec_data");
 
     if (val)
-      pad->codec_data = gst_buffer_ref (gst_value_get_buffer (val));
+      gst_buffer_replace (&pad->codec_data, gst_value_get_buffer (val));
   }
 
   gst_object_unref (mux);