diff mbox series

[FFmpeg-devel,20/34] avformat/avienc: Avoid allocating AVPacket

Message ID AM7PR03MB66603FC70B5667F2674EE0F88FD29@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/avienc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9eb072ce12..05bcb8cf79 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -275,9 +275,7 @@  static int avi_write_header(AVFormatContext *s)
         return AVERROR(EINVAL);
     }
 
-    avi->empty_packet = av_packet_alloc();
-    if (!avi->empty_packet)
-        return AVERROR(ENOMEM);
+    avi->empty_packet = s->internal->pkt;
 
     for (n = 0; n < s->nb_streams; n++) {
         s->streams[n]->priv_data = av_mallocz(sizeof(AVIStream));
@@ -980,10 +978,6 @@  static int avi_write_trailer(AVFormatContext *s)
 
 static void avi_deinit(AVFormatContext *s)
 {
-    AVIContext *avi = s->priv_data;
-
-    av_packet_free(&avi->empty_packet);
-
     for (int i = 0; i < s->nb_streams; i++) {
         AVIStream *avist = s->streams[i]->priv_data;
         if (!avist)