On Tue, Feb 17, 2015 at 10:12 AM, <[email protected]> wrote: > From: Federico Tomassetti <[email protected]> > > Bug-Id: CID 1257798 > Bug-Id: CID 1257805 > --- > libavformat/oggdec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c > index 760cc25..1dc3145 100644 > --- a/libavformat/oggdec.c > +++ b/libavformat/oggdec.c > @@ -63,6 +63,8 @@ static int ogg_save(AVFormatContext *s) > struct ogg *ogg = s->priv_data; > struct ogg_state *ost = > av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * > sizeof(*ogg->streams)); > + if (!ost) > + return AVERROR(ENOMEM); > int i; > ost->pos = avio_tell(s->pb); > ost->curidx = ogg->curidx; > @@ -190,6 +192,8 @@ static int ogg_new_buf(struct ogg *ogg, int idx) > { > struct ogg_stream *os = ogg->streams + idx; > uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); > + if (!nb) > + return AVERROR(ENOMEM); > int size = os->bufpos - os->pstart; > > if (os->buf) {
This won't do, you can't mix if checks and variable declarations. It should actually fail to build, I assume you ran make before sending the patch right? Finally there is at least one more allocation that should be checked, always double check searching for 'alloc' when writing this kind of patches. -- Vittorio _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
