From patchwork Sat Jan 11 13:27:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 17304 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 695BD449FE1 for ; Sat, 11 Jan 2020 15:31:12 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C5F568AF57; Sat, 11 Jan 2020 15:31:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BED9F68AF49 for ; Sat, 11 Jan 2020 15:31:04 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1iqGr1-0007Vy-0M for ffmpeg-devel@ffmpeg.org; Sat, 11 Jan 2020 14:31:03 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id qGq3iqjL8wlysqGq3i8KK4; Sat, 11 Jan 2020 14:30:03 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=cm27Pg_UAAAA:8 a=dQmca14HWr2h-mmTofsA:9 a=xmb-EsYY8bH0VWELuYED:22 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 11 Jan 2020 14:27:23 +0100 Message-Id: <20200111132723.16016-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200111132723.16016-1-michael@niedermayer.cc> References: <20200111132723.16016-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfMFGxK6Guxdx4TzFwETsU9UW3eMCBK/xkphklifSmTCeH1GC6kWsxAzUjmyhjPBczuVgg8ITZc+UN2PIBGFMGNRdvIWJHfOHHjGmEq1+yy28cfOB13jF DCluBasfQBkgaR17zevNGKTfFEhnY+FtBnzO00yDWeM9KU+hINzw/TbtFy4ddd83ZPYcONE+FpwqMJrQo31fsv9tysiu9UTSPKY= Subject: [FFmpeg-devel] [PATCH 2/2] avformat/mov: Free memory before returning in update_frag_index, when streams lack track id. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Thomas Guilbert Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Thomas Guilbert Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 75f098af09..c49fd4d43f 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1327,8 +1327,10 @@ static int update_frag_index(MOVContext *c, int64_t offset) for (i = 0; i < c->fc->nb_streams; i++) { // Avoid building frag index if streams lack track id. - if (c->fc->streams[i]->id < 0) + if (c->fc->streams[i]->id < 0) { + av_freep(&frag_stream_info); return AVERROR_INVALIDDATA; + } frag_stream_info[i].id = c->fc->streams[i]->id; frag_stream_info[i].sidx_pts = AV_NOPTS_VALUE;