diff mbox series

[FFmpeg-devel,23/34] avformat/mp3enc: Avoid stack packet

Message ID AM7PR03MB666061BC0DDE5703A4235B9E8FD29@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/11] avformat/mux: Sanitize packets without data and side-data
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 6, 2021, 2:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mp3enc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index c8328b8b9d..019e92ca8e 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 = s->internal->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;
 }