summaryrefslogtreecommitdiff
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-24 15:09:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-24 15:09:58 +0100
commitd69238e991844cb0e9407c26e64dd7a551aa5bab (patch)
treea6169232d84d75370f66dcf011f8d7ee45594f8a /libavformat/oggdec.c
parentc6664242e0700ea0bc10109c7e84c3f9cf7fb9ae (diff)
parentf3298f12997eb4b7ad203766f768f92e3dd72a2a (diff)
Merge commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a'
* commit 'f3298f12997eb4b7ad203766f768f92e3dd72a2a': Return proper error code after av_log_ask_for_sample() configure: cosmetics: Separate hwaccel dependencies from decoders/encoders oggdec: check memory allocation Conflicts: configure libavcodec/pictordec.c libavformat/anm.c libavformat/oggdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index acc2a6df6c..794a7754db 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -220,8 +220,8 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial)
if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 ||
!(os = av_realloc(ogg->streams, size)))
return AVERROR(ENOMEM);
- ogg->streams = os;
- os = ogg->streams + idx;
+ ogg->streams = os;
+ os = ogg->streams + idx;
memset(os, 0, sizeof(*os));
os->serial = serial;
os->bufsize = DECODER_BUFFER_SIZE;
@@ -374,6 +374,8 @@ static int ogg_read_page(AVFormatContext *s, int *sid)
if (os->bufsize - os->bufpos < size) {
uint8_t *nb = av_malloc((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!nb)
+ return AVERROR(ENOMEM);
memcpy(nb, os->buf, os->bufpos);
av_free(os->buf);
os->buf = nb;