[FFmpeg-cvslog] vorbisenc: check all allocations for failure
Alexander Strasser
eclipse7 at gmx.net
Sun Feb 26 14:29:29 CET 2012
Hi,
Justin Ruggles wrote:
> ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Feb 22 19:23:18 2012 -0500| [be8d812c9635f31f69c30dff9ebf565a07a7dab7] | committer: Justin Ruggles
>
> vorbisenc: check all allocations for failure
[...]
> @@ -167,6 +167,8 @@ static void ready_codebook(vorbis_enc_codebook *cb)
> int vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
> cb->dimentions = av_malloc(sizeof(float) * cb->nentries * cb->ndimentions);
> cb->pow2 = av_mallocz(sizeof(float) * cb->nentries);
> + if (!cb->dimentions || !cb->pow2)
> + return AVERROR(ENOMEM);
this leaves open the possibility to leak one of the two allocations.
A possible solution would be always trying to free both in the "error out"
path (av_free(NULL) should never hurt).
[...]
Alexander
More information about the ffmpeg-cvslog
mailing list