diff mbox

[FFmpeg-devel,02/13] avformat/mux: Don't unnecessarily zero-initialize AVPacketList

Message ID 20190813024726.6596-2-andreas.rheinhardt@gmail.com
State Accepted
Headers show

Commit Message

Andreas Rheinhardt Aug. 13, 2019, 2:47 a.m. UTC
If no error occurs and this AVPacketList is used at all, its packet
substructure will be overwritten and its next pointer explicitly set, so
every field will still be initialized even when using av_malloc.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 26, 2020, 4:09 p.m. UTC | #1
On Tue, Aug 13, 2019 at 04:47:15AM +0200, Andreas Rheinhardt wrote:
> If no error occurs and this AVPacketList is used at all, its packet
> substructure will be overwritten and its next pointer explicitly set, so
> every field will still be initialized even when using av_malloc.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/mux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/mux.c b/libavformat/mux.c
index ac370fb24d..870e716950 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -924,7 +924,7 @@  int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
     AVStream *st   = s->streams[pkt->stream_index];
     int chunked    = s->max_chunk_size || s->max_chunk_duration;
 
-    this_pktl      = av_mallocz(sizeof(AVPacketList));
+    this_pktl      = av_malloc(sizeof(AVPacketList));
     if (!this_pktl)
         return AVERROR(ENOMEM);
     if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) {