idcin: fix memleaks in idcin_read_packet()

Fixes fate-id-cin-video failures when running FATE with valgrind.
This commit is contained in:
Justin Ruggles 2013-01-15 16:20:57 -05:00
parent e034cc6c60
commit b805c725a3
1 changed files with 4 additions and 1 deletions

View File

@ -309,6 +309,7 @@ static int idcin_read_packet(AVFormatContext *s,
return ret; return ret;
else if (ret != chunk_size) { else if (ret != chunk_size) {
av_log(s, AV_LOG_ERROR, "incomplete packet\n"); av_log(s, AV_LOG_ERROR, "incomplete packet\n");
av_free_packet(pkt);
return AVERROR(EIO); return AVERROR(EIO);
} }
if (command == 1) { if (command == 1) {
@ -316,8 +317,10 @@ static int idcin_read_packet(AVFormatContext *s,
pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE); AVPALETTE_SIZE);
if (ret < 0) if (ret < 0) {
av_free_packet(pkt);
return ret; return ret;
}
memcpy(pal, palette, AVPALETTE_SIZE); memcpy(pal, palette, AVPALETTE_SIZE);
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
} }