mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-17 20:37:04 +00:00
avformat/matroskadec: address some more missing AVPacket frees
Fixes memleaks. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
2f27370111
commit
4f55b94663
@ -2913,13 +2913,10 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
|
|||||||
|
|
||||||
while (track->audio.pkt_cnt) {
|
while (track->audio.pkt_cnt) {
|
||||||
int ret;
|
int ret;
|
||||||
AVPacket *pkt = av_mallocz(sizeof(AVPacket));
|
AVPacket pktl, *pkt = &pktl;
|
||||||
if (!pkt)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
ret = av_new_packet(pkt, a);
|
ret = av_new_packet(pkt, a);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_free(pkt);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
memcpy(pkt->data,
|
memcpy(pkt->data,
|
||||||
@ -2931,7 +2928,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
|
|||||||
pkt->stream_index = st->index;
|
pkt->stream_index = st->index;
|
||||||
ret = ff_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, 0);
|
ret = ff_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_packet_free(&pkt);
|
av_packet_unref(pkt);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3028,7 +3025,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
|
|||||||
uint64_t duration,
|
uint64_t duration,
|
||||||
int64_t pos)
|
int64_t pos)
|
||||||
{
|
{
|
||||||
AVPacket *pkt;
|
AVPacket pktl, *pkt = &pktl;
|
||||||
uint8_t *id, *settings, *text, *buf;
|
uint8_t *id, *settings, *text, *buf;
|
||||||
int id_len, settings_len, text_len;
|
int id_len, settings_len, text_len;
|
||||||
uint8_t *p, *q;
|
uint8_t *p, *q;
|
||||||
@ -3085,12 +3082,8 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
|
|||||||
if (text_len <= 0)
|
if (text_len <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
pkt = av_mallocz(sizeof(*pkt));
|
|
||||||
if (!pkt)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
err = av_new_packet(pkt, text_len);
|
err = av_new_packet(pkt, text_len);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_free(pkt);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3102,7 +3095,6 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
|
|||||||
id_len);
|
id_len);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
av_packet_unref(pkt);
|
av_packet_unref(pkt);
|
||||||
av_free(pkt);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
memcpy(buf, id, id_len);
|
memcpy(buf, id, id_len);
|
||||||
@ -3114,7 +3106,6 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
|
|||||||
settings_len);
|
settings_len);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
av_packet_unref(pkt);
|
av_packet_unref(pkt);
|
||||||
av_free(pkt);
|
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
memcpy(buf, settings, settings_len);
|
memcpy(buf, settings, settings_len);
|
||||||
@ -3134,7 +3125,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska,
|
|||||||
|
|
||||||
err = ff_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, 0);
|
err = ff_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_packet_free(&pkt);
|
av_packet_unref(pkt);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user