diff mbox series

[FFmpeg-devel,25/34] avformat/flacenc: Avoid stack packet

Message ID AM7PR03MB666047CA72D5B12D341147B58FD29@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/flacenc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 44c9341493..ab57a1e45a 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -299,7 +299,7 @@  static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt)
 static int flac_queue_flush(AVFormatContext *s)
 {
     FlacMuxerContext *c = s->priv_data;
-    AVPacket pkt;
+    AVPacket *const pkt = s->internal->pkt;
     int ret, write = 1;
 
     ret = flac_finish_header(s);
@@ -307,10 +307,10 @@  static int flac_queue_flush(AVFormatContext *s)
         write = 0;
 
     while (c->queue) {
-        avpriv_packet_list_get(&c->queue, &c->queue_end, &pkt);
-        if (write && (ret = flac_write_audio_packet(s, &pkt)) < 0)
+        avpriv_packet_list_get(&c->queue, &c->queue_end, pkt);
+        if (write && (ret = flac_write_audio_packet(s, pkt)) < 0)
             write = 0;
-        av_packet_unref(&pkt);
+        av_packet_unref(pkt);
     }
     return ret;
 }