On Sat, Dec 07, 2013 at 11:04:52AM -0500, Sean McGovern wrote:
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -63,6 +63,10 @@ static int ogg_save(AVFormatContext *s)
> struct ogg_state *ost =
> av_malloc(sizeof(*ost) + (ogg->nstreams - 1) *
> sizeof(*ogg->streams));
> int i;
> +
> + if (!ost)
> + return AVERROR(ENOMEM);
The "int i;" placement is weird IMO.
> @@ -72,6 +76,8 @@ static int ogg_save(AVFormatContext *s)
> for (i = 0; i < ogg->nstreams; i++) {
> struct ogg_stream *os = ogg->streams + i;
> os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
> + if (!os->buf)
> + return AVERROR(ENOMEM);
> memcpy(os->buf, ost->streams[i].buf, os->bufpos);
> }
You are leaking ost from above I think.
> @@ -173,6 +179,9 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t
> serial, int new_avstream)
> os->header = -1;
> os->start_granule = OGG_NOGRANULE_VALUE;
>
> + if (!os->buf)
> + return AVERROR(ENOMEM);
You seem to leak ogg->streams from above.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel