Andreas Rheinhardt (12020-08-08): > Now that the output's refs-array is only allocated once, it is NULL in > any error case and therefore needn't be freed at all. Furthermore, it is > unnecessary to av_freep(&ptr) when ptr == NULL. > > Signed-off-by: Andreas Rheinhardt <[email protected]> > --- > libavfilter/formats.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c > index ae44006dfe..e452fd0408 100644 > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -141,10 +141,9 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, > AVFilterFormats *b, > return ret; > fail: > if (ret) {
> - av_freep(&ret->refs);
It seems fragile. We could easily unmake the change that guarantees that
refs is NULL, or use fail for another exit later. Maybe add an
av_assert1()?
> av_freep(&ret->formats);
> + av_freep(&ret);
> }
> - av_freep(&ret);
This one ok, of course.
> return NULL;
> }
>
> @@ -168,10 +167,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
> return ret;
> fail:
> if (ret) {
> - av_freep(&ret->refs);
> av_freep(&ret->formats);
> + av_freep(&ret);
> }
> - av_freep(&ret);
> return NULL;
> }
>
> @@ -261,10 +259,9 @@ AVFilterChannelLayouts
> *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
>
> fail:
> if (ret) {
> - av_freep(&ret->refs);
> av_freep(&ret->channel_layouts);
> + av_freep(&ret);
> }
> - av_freep(&ret);
> return NULL;
> }
Regards,
--
Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
