summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2012-04-12 17:14:35 -0700
committerMichael Niedermayer <michaelni@gmx.at>2012-04-13 11:43:10 +0200
commitb5ada68ead1ff92e1fab7ddc9b0ac60d5da3edeb (patch)
treec69b6d7382b5804b82b98cebe6ad755d64f6b57e /libavformat/matroskadec.c
parentfd165a0b3166bd4605f4f65197b0d43c9382f3e7 (diff)
matroska: Fix leaking memory allocated for laces.
During error conditions matroska_parse_block may exit without freeing the memory allocated for laces. Found via valgrind: http://pastebin.com/E54k8QFU Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6d7401bfdd..856508ca77 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1940,6 +1940,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (size < cfs * h / 2) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt int4 RM-style audio packet size\n");
+ av_free(lace_size);
return AVERROR_INVALIDDATA;
}
for (x=0; x<h/2; x++)
@@ -1949,6 +1950,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (size < w) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt sipr RM-style audio packet size\n");
+ av_free(lace_size);
return AVERROR_INVALIDDATA;
}
memcpy(track->audio.buf + y*w, data, w);
@@ -1956,6 +1958,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (size < sps * w / sps) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Corrupt generic RM-style audio packet size\n");
+ av_free(lace_size);
return AVERROR_INVALIDDATA;
}
for (x=0; x<w/sps; x++)