From ad2a08388c82bdec5ac9355ca6e0bc4c98b26423 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 19 Sep 2013 14:51:46 +0200 Subject: [PATCH] avformat/concat: revert one hunk of 20dfab33f5ab61fc51de65192ed239f8b62782a2 The deallocated memory contains resources that need to be freed before it can be deallocated. The original code was correct. This also fixes a double free Signed-off-by: Michael Niedermayer --- libavformat/concat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/concat.c b/libavformat/concat.c index 849b61a092..5f8209b252 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -111,9 +111,10 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) if (err < 0) concat_close(h); - else if ((err = av_reallocp(&nodes, data->length * sizeof(*nodes))) < 0) + else if (!(nodes = av_realloc(nodes, data->length * sizeof(*nodes)))) { concat_close(h); - else + err = AVERROR(ENOMEM); + } else data->nodes = nodes; return err; }