From patchwork Fri Apr 21 09:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 753231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3w8Vgv4pHgz9s78; Fri, 21 Apr 2017 19:24:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1d1UoC-0000iO-Qy; Fri, 21 Apr 2017 09:24:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1d1Uo8-0000hY-8O for fwts-devel@lists.ubuntu.com; Fri, 21 Apr 2017 09:24:52 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1d1Uo7-0001vh-Tn; Fri, 21 Apr 2017 09:24:52 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: fwts_gpe: fix double free on gpe buffer Date: Fri, 21 Apr 2017 10:24:51 +0100 Message-Id: <20170421092451.8454-1-colin.king@canonical.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King My previous memory leak fix introduced a double free bug, fix this by not free'ing the buffer twice. Issue detected by CoverityScan. Fixes: 5a4034ff7938 ("lib: fwts_gpe: free original gpe buffer on failed realloc") Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_gpe.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/src/fwts_gpe.c b/src/lib/src/fwts_gpe.c index a16fee86..2b3db0f5 100644 --- a/src/lib/src/fwts_gpe.c +++ b/src/lib/src/fwts_gpe.c @@ -66,7 +66,6 @@ int fwts_gpe_read(fwts_gpe **gpes) tmp = realloc(*gpes, sizeof(fwts_gpe) * (n+1)); if (!tmp) { - free(*gpes); goto error; } else { char path[PATH_MAX];