[FFmpeg-cvslog] avformat/mp3enc: Avoid stack packet

Andreas Rheinhardt git at videolan.org
Sun Oct 3 23:49:02 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Mar 18 07:28:03 2021 +0100| [0bf63099cd0c0dac27e3bd3f8fb1c873a4523e1e] | committer: Andreas Rheinhardt

avformat/mp3enc: Avoid stack packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavformat/mp3enc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index c8328b8b9d..e4b2a65b07 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -381,17 +381,17 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
 static int mp3_queue_flush(AVFormatContext *s)
 {
     MP3Context *mp3 = s->priv_data;
-    AVPacket pkt;
+    AVPacket *const pkt = ffformatcontext(s)->pkt;
     int ret = 0, write = 1;
 
     ff_id3v2_finish(&mp3->id3, s->pb, s->metadata_header_padding);
     mp3_write_xing(s);
 
     while (mp3->queue) {
-        avpriv_packet_list_get(&mp3->queue, &mp3->queue_end, &pkt);
-        if (write && (ret = mp3_write_audio_packet(s, &pkt)) < 0)
+        avpriv_packet_list_get(&mp3->queue, &mp3->queue_end, pkt);
+        if (write && (ret = mp3_write_audio_packet(s, pkt)) < 0)
             write = 0;
-        av_packet_unref(&pkt);
+        av_packet_unref(pkt);
     }
     return ret;
 }



More information about the ffmpeg-cvslog mailing list