diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index 378a9b3b36..d4191c02cc 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -228,7 +228,7 @@ static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet) int ret; if (!apng->prev_packet) { - apng->prev_packet = av_malloc(sizeof(*apng->prev_packet)); + apng->prev_packet = av_packet_alloc(); if (!apng->prev_packet) return AVERROR(ENOMEM);