From patchwork Mon Sep 28 17:36:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22649 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 7AB08449D09 for ; Mon, 28 Sep 2020 20:37:19 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5DB2968B777; Mon, 28 Sep 2020 20:37:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E044568B75D for ; Mon, 28 Sep 2020 20:37:12 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id t10so2300447wrv.1 for ; Mon, 28 Sep 2020 10:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CXEK2saNb1PLf4JNgWdlwwLccakCuGkxf8QM3KSBNOo=; b=IrfNfyLogjj0MYlKRWq87jhcK7iiuHbWDpc1asRLeM0TiTelGXQNFSKjR72N3nPoek XzXPtooONAKHD+7hqX3TOv8EXLSqcJMo1Fro52/HR8tcNR+XPAly7eMpxTtCEbK3p4mF LDtNGK6kedvMcD7VOyEC/TZtoA9pli6SeXnwKRh5rOvhTVHIb5lYFhHDi2nLISc414bZ +FClOKYWpd+TY+DnlUTIMHodkRshDeiSFpMOErl1HRPkgyJyOI5JLBjto9KyUcUB1bul dmt3Fa3dAfi1qXLrvAn1/82fv7T4J4+AK9srt3r+ZhbuK30rX5nV74/kABSQGqvopck6 2AKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CXEK2saNb1PLf4JNgWdlwwLccakCuGkxf8QM3KSBNOo=; b=a7s0YNnz76gYfHGMqUb/VTAnKk7CLDOC9OpWOqg32AZTbzyEFUbQZJBh+LvfQkpqL5 5NsiXUfFAHsAvz09PlkqnrdQfih5XocRPz39eUo3sbNxEEQF8K2Zg65I3saIsPIXfcls sk1ZPBA2aZKEu3ZLOXMQQUbl1B6hR13DIqoEenFVXFBfK9H+agM+39AobQgali6wB2y5 1upIa5jy1mK0xJZoxMyEf4QB7mwD30xgsgVKEwtm1FE48ycwtu80cfp8QqROdVG8Nvot 81GmdauWNwwpvIWN8mAXQcBVu3lQnu4cgqDMATCMIXIS5i8xGGYB0uBDSgH2V2Z3TPwz L9dg== X-Gm-Message-State: AOAM531vJdPf2K7zDeirUufvHleXa/lNIE6bxNxp6aYRpvPsyyrvJCpq Avg3t/h+YxgTmm5w1S+3f5dRS85Jmj8= X-Google-Smtp-Source: ABdhPJwtvEaNrie5C07ibzhlKlbwiqRHhYyEZaYRS0WFvOMSyueh5pEB1KReZZYOYTaZgv0TreMOiw== X-Received: by 2002:adf:e407:: with SMTP id g7mr2827575wrm.349.1601314632057; Mon, 28 Sep 2020 10:37:12 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l3sm2047021wmh.27.2020.09.28.10.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 10:37:11 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 28 Sep 2020 19:36:41 +0200 Message-Id: <20200928173642.701462-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928173642.701462-1-andreas.rheinhardt@gmail.com> References: <20200928173642.701462-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/movenc: Don't forget to free fragment buffers 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The buffers used when fragmented output is enabled have up until now not been freed in the deinit function; they leak e.g. if one errors out of mov_write_trailer() before one reaches the point where they are normally written out and freed. This can e.g. happen if allocating new vos_data fails at the beginning of mov_write_trailer(). Signed-off-by: Andreas Rheinhardt --- libavformat/movenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index c53be74a64..c12dd1e672 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6279,9 +6279,11 @@ static void mov_free(AVFormatContext *s) av_freep(&mov->tracks[i].vos_data); ff_mov_cenc_free(&mov->tracks[i].cenc); + ffio_free_dyn_buf(&mov->tracks[i].mdat_buf); } av_freep(&mov->tracks); + ffio_free_dyn_buf(&mov->mdat_buf); } static uint32_t rgb_to_yuv(uint32_t rgb)