diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 7eca05b9b0..0f71b287bc 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -988,8 +988,7 @@ matroska_deliver_packet (MatroskaDemuxContext *matroska, av_realloc(matroska->packets, (matroska->num_packets - 1) * sizeof(AVPacket *)); } else { - av_free(matroska->packets); - matroska->packets = NULL; + av_freep(&matroska->packets); } matroska->num_packets--; return 0;