summaryrefslogtreecommitdiff
path: root/libavformat/nutdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-19 20:46:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-19 21:23:52 +0200
commit2a976debc1de10c22c258583b543ab5b4bbe5974 (patch)
treea2b0a12017a42e8a37365ca84a6bf2a0179311e8 /libavformat/nutdec.c
parent2ff935f4bb6173daf3361b2ac7b58c6e33994878 (diff)
parent2b98377935384ecd22c2cd26106b9e03a6c9f598 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: dv: Initialize encoder tables during encoder init. dv: Replace some magic numbers by the appropriate #define. FATE: pass the decoded output format and audio source file to enc_dec_pcm FATE: specify the input format when decoding in enc_dec_pcm() x86inc: support AVX abstraction for 2-operand instructions configure: detect PGI compiler and set suitable flags avconv: check for an incompatible changing channel layout avio: make AVIOContext.av_class pointer to const nutdec: add malloc check and fix const to non-const conversion warnings Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r--libavformat/nutdec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index be2fd82769..29771a2d68 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -305,14 +305,18 @@ static int decode_main_header(NUTContext *nut)
GET_V(nut->header_count, tmp < 128U)
nut->header_count++;
for (i = 1; i < nut->header_count; i++) {
+ uint8_t *hdr;
GET_V(nut->header_len[i], tmp > 0 && tmp < 256);
rem -= nut->header_len[i];
if (rem < 0) {
av_log(s, AV_LOG_ERROR, "invalid elision header\n");
return AVERROR_INVALIDDATA;
}
- nut->header[i] = av_malloc(nut->header_len[i]);
- avio_read(bc, nut->header[i], nut->header_len[i]);
+ hdr = av_malloc(nut->header_len[i]);
+ if (!hdr)
+ return AVERROR(ENOMEM);
+ avio_read(bc, hdr, nut->header_len[i]);
+ nut->header[i] = hdr;
}
assert(nut->header_len[0] == 0);
}