From patchwork Thu Nov 21 06:17:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16358 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 B405544A71E for ; Thu, 21 Nov 2019 08:41:10 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 90DE668A141; Thu, 21 Nov 2019 08:41:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8CFB46880F5 for ; Thu, 21 Nov 2019 08:41:04 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id z3so2935366wru.3 for ; Wed, 20 Nov 2019 22:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UW2ImhtCVS0acG24ESUgbRYKE0DNZk3ij7aoiyM3bBA=; b=nPOnCzay6D8NnGSDI/L/eUtl1Fuy7icg/1bh5r9GI0Dv701xALu99mdZCPei94ystq bM1QqDyB9q0zY+I1GysI4LhtP+2EpgyyxbJTZOrSU4nnxbjWzr9HIL+JD5ZEKt7GAinq LyJLni8ktFvLoIV7sEzWfL3tiRFW4GQBOfESYUWSoD+pfB6XkGGIahDkoczvLPlip6ha CUyGZ45LKs2onK9TWcJzyOTSwtBAJohcCYvng9MVnfTFsXkCDwztNAw3/pRxXA4S370e nc7ZVUqImszvd7deNEn9uVAMJ/tLQUo4tJDbh/yupZBRxlQ47TY1j/vxnOodgsjvpqQt qOpg== 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:mime-version :content-transfer-encoding; bh=UW2ImhtCVS0acG24ESUgbRYKE0DNZk3ij7aoiyM3bBA=; b=TiU17UiYhQyHF0S1KPpEWSa0o3EtQ6maKedPLNGpAGlUuOC+9cygcUN3hDlT3nt03j Bp/zYkueGmKn6OuA+B0O6WJCjuifcpXKUGPci6r8kotWJCahnfoSxKtDH+kJadOwIdjQ SEiGH+jmS1CXCT+mp30H0yprqW/00lCH9cOQRbn9uz/eegz7AX0Sb8o5ZsUggZIq5dGD BgRk9q0nKM8P/4wXUAocOsaT8kY0Ap4Ts/CYspGiYiav7HoJsLMbSP5kslaJvw5fB/8y z9Ja26Ttv31XMR+90eNgtEcbiC4L/V6QzNSVVXhsJhx4DB/WfXFQa5nrNET2nXrxCV6v uXgA== X-Gm-Message-State: APjAAAXd8kATs0euDnF0THfg+Go5aoLXT0OZ+AYrKn+a5DMgWNtu5lOC KRuF/C6lDrDyEgiYEqiK9oTzeZf6 X-Google-Smtp-Source: APXvYqzsIvMsTtW5IsxM/uSVpbZ9mS1xrGnt6wflejarIg3PUvIwo8oFhILpKki5Jyn5W7mAfN4fSQ== X-Received: by 2002:a5d:5224:: with SMTP id i4mr8339450wra.303.1574317046959; Wed, 20 Nov 2019 22:17:26 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08e23.dynamic.kabel-deutschland.de. [188.192.142.35]) by smtp.gmail.com with ESMTPSA id v128sm1951618wmb.14.2019.11.20.22.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 22:17:26 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 21 Nov 2019 07:17:19 +0100 Message-Id: <20191121061719.28878-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/av1: Fix leak of dynamic buffer in case of parsing failure 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" Signed-off-by: Andreas Rheinhardt --- libavformat/av1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/av1.c b/libavformat/av1.c index b36c5e44ba..03669dfd2a 100644 --- a/libavformat/av1.c +++ b/libavformat/av1.c @@ -26,6 +26,7 @@ #include "libavcodec/put_bits.h" #include "av1.h" #include "avio.h" +#include "avio_internal.h" int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size) { @@ -67,8 +68,10 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size) return ret; ret = ff_av1_filter_obus(pb, buf, *size); - if (ret < 0) + if (ret < 0) { + ffio_free_dyn_buf(&pb); return ret; + } av_freep(out); *size = avio_close_dyn_buf(pb, out);