[FFmpeg-devel] [PATCH 5/6] avfilter/formats: Simplify cleanup for ff_merge_* functions
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Sat Aug 8 17:02:02 EEST 2020
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 <andreas.rheinhardt at gmail.com>
---
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);
av_freep(&ret->formats);
+ av_freep(&ret);
}
- av_freep(&ret);
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;
}
--
2.20.1
More information about the ffmpeg-devel
mailing list