summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavard Graff <havard.graff@gmail.com>2015-12-04 00:46:34 +1100
committerTim-Philipp Müller <tim@centricular.com>2016-02-19 14:59:09 +0000
commit7787f439fca95f5fdf121477493ada8da91fb8a2 (patch)
treec6dab0ed38097baa86c3f38e0fb7c7413835f4a6
parent1e09e5bfe97e72cd021eb0dcc2c5bda8e4309498 (diff)
downloadgstreamer-plugins-good-7787f439fca95f5fdf121477493ada8da91fb8a2.tar.gz
flvmux: plug leak(s) in error-scenario
https://bugzilla.gnome.org/show_bug.cgi?id=762210
-rw-r--r--gst/flv/gstflvmux.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c
index b7c0b5168..30d952679 100644
--- a/gst/flv/gstflvmux.c
+++ b/gst/flv/gstflvmux.c
@@ -1317,21 +1317,35 @@ gst_flv_mux_write_header (GstFlvMux * mux)
/* push the header buffer, the metadata and the codec info, if any */
ret = gst_flv_mux_push (mux, header);
if (ret != GST_FLOW_OK)
- return ret;
+ goto failure_header;
ret = gst_flv_mux_push (mux, metadata);
if (ret != GST_FLOW_OK)
- return ret;
+ goto failure_metadata;
if (video_codec_data != NULL) {
ret = gst_flv_mux_push (mux, video_codec_data);
if (ret != GST_FLOW_OK)
- return ret;
+ goto failure_video_codec_data;
}
if (audio_codec_data != NULL) {
ret = gst_flv_mux_push (mux, audio_codec_data);
if (ret != GST_FLOW_OK)
- return ret;
+ goto failure_audio_codec_data;
}
return GST_FLOW_OK;
+
+failure_header:
+ gst_buffer_unref (metadata);
+
+failure_metadata:
+ if (video_codec_data != NULL)
+ gst_buffer_unref (video_codec_data);
+
+failure_video_codec_data:
+ if (audio_codec_data != NULL)
+ gst_buffer_unref (audio_codec_data);
+
+failure_audio_codec_data:
+ return ret;
}
static void
@@ -1581,8 +1595,10 @@ gst_flv_mux_handle_buffer (GstCollectPads * pads, GstCollectData * cdata,
}
ret = gst_flv_mux_write_header (mux);
- if (ret != GST_FLOW_OK)
- return ret;
+ if (ret != GST_FLOW_OK) {
+ gst_buffer_unref (buffer);
+ return ret;
+ }
mux->state = GST_FLV_MUX_STATE_DATA;
if (GST_COLLECT_PADS_DTS_IS_VALID (cdata))