[FFmpeg-devel] [PATCH 1/3] Replace DUP_DATA & memset with 0 by av_mallocz
Andrey Utkin
andrey.krieger.utkin at gmail.com
Mon Sep 17 18:55:01 CEST 2012
Offtop childish question: does malloc(struct_size * number) always alloc same size as calloc(number, struct_size)? I.e. is having two params in calloc() a nonsense?
---8<---
---
libavcodec/avpacket.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dbbba56..03754c5 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -140,10 +140,7 @@ int av_dup_packet(AVPacket *pkt)
if (pkt->side_data_elems) {
int i;
- DUP_DATA(pkt->side_data, tmp_pkt.side_data,
- pkt->side_data_elems * sizeof(*pkt->side_data), 0);
- memset(pkt->side_data, 0,
- pkt->side_data_elems * sizeof(*pkt->side_data));
+ pkt->side_data = av_mallocz(pkt->side_data_elems * sizeof(*pkt->side_data));
for (i = 0; i < pkt->side_data_elems; i++)
DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data,
tmp_pkt.side_data[i].size, 1);
--
1.7.8.6
More information about the ffmpeg-devel
mailing list