diff mbox series

[FFmpeg-devel] avformat/nutenc: Drop redundant frees

Message ID 20200314163217.22706-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avformat/nutenc: Drop redundant frees
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt March 14, 2020, 4:32 p.m. UTC
Should writing the header fail, the allocations already performed will
be freed during deinit so remove the frees in nut_write_header().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/nutenc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Michael Niedermayer March 14, 2020, 9 p.m. UTC | #1
On Sat, Mar 14, 2020 at 05:32:17PM +0100, Andreas Rheinhardt wrote:
> Should writing the header fail, the allocations already performed will
> be freed during deinit so remove the frees in nut_write_header().
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/nutenc.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 44773924dd..1d48625815 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -703,12 +703,8 @@  static int nut_write_header(AVFormatContext *s)
     nut->chapter  = av_calloc(s->nb_chapters, sizeof(*nut->chapter));
     nut->time_base= av_calloc(s->nb_streams +
                               s->nb_chapters, sizeof(*nut->time_base));
-    if (!nut->stream || !nut->chapter || !nut->time_base) {
-        av_freep(&nut->stream);
-        av_freep(&nut->chapter);
-        av_freep(&nut->time_base);
+    if (!nut->stream || !nut->chapter || !nut->time_base)
         return AVERROR(ENOMEM);
-    }
 
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];