[FFmpeg-cvslog] avconv: Check that muxing_queue exists before reading from it

Diego Biurrun git at videolan.org
Wed Mar 15 15:28:31 EET 2017


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Jul 25 15:04:02 2016 +0200| [e46a6fb7732a7caef97a916a4f765ec0f779d195] | committer: Diego Biurrun

avconv: Check that muxing_queue exists before reading from it

This avoids a segfault on nonexisting codec names.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e46a6fb7732a7caef97a916a4f765ec0f779d195
---

 avconv.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/avconv.c b/avconv.c
index 57c02ac..43d67e8 100644
--- a/avconv.c
+++ b/avconv.c
@@ -203,13 +203,15 @@ static void avconv_cleanup(int ret)
 
         avcodec_free_context(&ost->enc_ctx);
 
-        while (av_fifo_size(ost->muxing_queue)) {
-            AVPacket pkt;
-            av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
-            av_packet_unref(&pkt);
+        if (ost->muxing_queue) {
+            while (av_fifo_size(ost->muxing_queue)) {
+                AVPacket pkt;
+                av_log(NULL, AV_LOG_INFO, "after av_fifo_size()\n");
+                av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
+                av_packet_unref(&pkt);
+            }
+            av_fifo_free(ost->muxing_queue);
         }
-        av_fifo_free(ost->muxing_queue);
-
         av_freep(&output_streams[i]);
     }
     for (i = 0; i < nb_input_files; i++) {



More information about the ffmpeg-cvslog mailing list