diff options
author | James Almer <jamrial@gmail.com> | 2018-04-04 10:54:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-04-04 10:54:14 -0300 |
commit | 2f0e0deadc4ead545c9042ed4c19211a2daa235a (patch) | |
tree | 3722345b5c12899fe2ccc987edcb825982b38570 /libavformat/matroskadec.c | |
parent | 2accdd3871a1f8c6ce0cf3f0e89fb04c47cc7148 (diff) | |
download | ffmpeg-2f0e0deadc4ead545c9042ed4c19211a2daa235a.tar.gz |
avformat/matroskadec: address a missing AVPacket free
Fixes memleaks.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 3e5b537ac4..a616fb3241 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -3152,7 +3152,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t *pkt_data = data; int offset = 0, res; - AVPacket *pkt; + AVPacket pktl, *pkt = &pktl; if (encodings && !encodings->type && encodings->scope & 1) { res = matroska_decode_buffer(&pkt_data, &pkt_size, track); @@ -3177,15 +3177,8 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, AV_RB32(&data[4]) != MKBETAG('i', 'c', 'p', 'f')) offset = 8; - pkt = av_mallocz(sizeof(AVPacket)); - if (!pkt) { - if (pkt_data != data) - av_freep(&pkt_data); - return AVERROR(ENOMEM); - } /* XXX: prevent data copy... */ if (av_new_packet(pkt, pkt_size + offset) < 0) { - av_free(pkt); res = AVERROR(ENOMEM); goto fail; } @@ -3210,7 +3203,6 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, additional_size + 8); if (!side_data) { av_packet_unref(pkt); - av_free(pkt); return AVERROR(ENOMEM); } AV_WB64(side_data, additional_id); @@ -3223,7 +3215,6 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, 10); if (!side_data) { av_packet_unref(pkt); - av_free(pkt); return AVERROR(ENOMEM); } discard_padding = av_rescale_q(discard_padding, @@ -3253,7 +3244,7 @@ FF_ENABLE_DEPRECATION_WARNINGS res = ff_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, 0); if (res < 0) { - av_packet_free(&pkt); + av_packet_unref(pkt); return AVERROR(ENOMEM); } |