avformat/isom: don't free extradata before calling ff_get_extradata()
authorJames Almer <jamrial@gmail.com>
Wed, 7 Mar 2018 02:26:22 +0000 (23:26 -0300)
committerJames Almer <jamrial@gmail.com>
Wed, 7 Mar 2018 02:41:32 +0000 (23:41 -0300)
ff_get_extradata() frees any existing extradata before allocating now,
and using av_free() here leaves a dangling pointer that will result in
a double free.

Fixes a regression since 0ca33b1d4eb2a2a2e78ff3a37f1647917635b0d2.

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
libavformat/isom.c

index 59502a8..2792371 100644 (file)
@@ -526,7 +526,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
         av_log(fc, AV_LOG_TRACE, "Specific MPEG-4 header len=%d\n", len);
         if (!len || (uint64_t)len > (1<<30))
             return AVERROR_INVALIDDATA;
-        av_free(st->codecpar->extradata);
         if ((ret = ff_get_extradata(fc, st->codecpar, pb, len)) < 0)
             return ret;
         if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {