X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavfilter%2Fformats.c;h=eb3b87a56c08ab4f0b9ec54aba4a5733c91d3a49;hp=816042987d034325659bfc795fb59171fafd0425;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavfilter/formats.c b/ffmpeg/libavfilter/formats.c index 8160429..eb3b87a 100644 --- a/ffmpeg/libavfilter/formats.c +++ b/ffmpeg/libavfilter/formats.c @@ -314,14 +314,18 @@ AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts) #define ADD_FORMAT(f, fmt, type, list, nb) \ do { \ type *fmts; \ + void *oldf = *f; \ \ if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) \ return AVERROR(ENOMEM); \ \ fmts = av_realloc((*f)->list, \ sizeof(*(*f)->list) * ((*f)->nb + 1));\ - if (!fmts) \ + if (!fmts) { \ + if (!oldf) \ + av_freep(f); \ return AVERROR(ENOMEM); \ + } \ \ (*f)->list = fmts; \ (*f)->list[(*f)->nb++] = fmt; \ @@ -490,7 +494,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) } #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \ -{ \ +if (fmts) { \ int count = 0, i; \ \ for (i = 0; i < ctx->nb_inputs; i++) { \