summaryrefslogtreecommitdiff
path: root/libavformat/xwma.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-01 18:17:20 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-01 18:25:34 +0200
commitb9fbd034bfd4b323d57bc2ac888301c93fcfd4ca (patch)
tree530cd6ba014725e8dc97f8f2652ac2430a41efbe /libavformat/xwma.c
parent5b911f1d5be45dd125ea48f0e9ff0cdeacba4dac (diff)
avformat/xwma: Use ff_alloc_extradata()
This prevents the fields from potentially becoming inconsistent in case of errors Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/xwma.c')
-rw-r--r--libavformat/xwma.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 075a85a2e7..a1f2dc224a 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -104,11 +104,10 @@ static int xwma_read_header(AVFormatContext *s)
avpriv_request_sample(s, "Unexpected extradata (%d bytes)",
st->codec->extradata_size);
} else {
- st->codec->extradata_size = 6;
- st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!st->codec->extradata)
+ if (ff_alloc_extradata(st->codec, 6))
return AVERROR(ENOMEM);
+ memset(st->codec->extradata, 0, st->codec->extradata_size);
/* setup extradata with our experimentally obtained value */
st->codec->extradata[4] = 31;
}