[FFmpeg-devel] [PATCH] avformat/movenc: remove call to av_copy_packet_side_data() when concatenatic eac3 syncframes

James Almer jamrial at gmail.com
Tue Apr 14 23:37:33 EEST 2020


This generates a potential memory leak if info->pkt already contains side data
elements, and may mix side data from the last packet with other properties from
the first.

Keep all the properties from the first packet only in the output packet
instead.

Signed-off-by: James Almer <jamrial at gmail.com>
---
The alternative is to keep all the properties of the last packet instead of the
first, or merge the side data from all packets into the output packet, giving
priority to the either the first or the last in case of duplicate side data
types.

I have no idea what would be ideal since i don't have a sample that triggers
this code, and i don't know what kind of side data these eac3 packets could
contain that one would need to choose between them.

 libavformat/movenc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bc8d08044e..bf3e4fa2ce 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -520,8 +520,6 @@ concatenate:
         memcpy(info->pkt.data + info->pkt.size - pkt->size, pkt->data, pkt->size);
         info->num_blocks += num_blocks;
         info->pkt.duration += pkt->duration;
-        if ((ret = av_copy_packet_side_data(&info->pkt, pkt)) < 0)
-            goto end;
         if (info->num_blocks != 6)
             goto end;
         av_packet_unref(pkt);
-- 
2.26.0



More information about the ffmpeg-devel mailing list