diff options
author | Matej Knopp <matej.knopp@gmail.com> | 2020-06-30 18:33:56 +0200 |
---|---|---|
committer | Matej Knopp <matej.knopp@gmail.com> | 2020-06-30 18:39:59 +0200 |
commit | d84b922b7fc9294b78e4718159f3b6085b6c2e5a (patch) | |
tree | ff30c0f6e598b8167712312848ba1690e8eff8ad /ext | |
parent | f7371f86919a904b24b3888abf029fa754bca78c (diff) |
avauddec: fix buffer leak when send packet failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/81>
Diffstat (limited to 'ext')
-rw-r--r-- | ext/libav/gstavauddec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index d518b70..756f92d 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -701,7 +701,7 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) gst_avpacket_init (&packet, data, size); if (!packet.size) - goto done; + goto unmap; if (avcodec_send_packet (ffmpegdec->context, &packet) < 0) { goto send_packet_failed; @@ -722,14 +722,15 @@ gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) } } while (got_frame); - gst_buffer_unmap (inbuf, &map); - gst_buffer_unref (inbuf); - if (is_header || got_any_frames) { ret = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (ffmpegdec), NULL, 1); } +unmap: + gst_buffer_unmap (inbuf, &map); + gst_buffer_unref (inbuf); + done: return ret; @@ -747,7 +748,7 @@ not_negotiated: send_packet_failed: { GST_WARNING_OBJECT (ffmpegdec, "decoding error"); - goto done; + goto unmap; } } |