From patchwork Mon May 6 21:50:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 241798 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 56BEB2C00AC for ; Tue, 7 May 2013 07:50:14 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UZTIT-0005yQ-Ih; Mon, 06 May 2013 21:50:13 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UZTIN-0005yF-4s for fwts-devel@lists.ubuntu.com; Mon, 06 May 2013 21:50:07 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1UZTIN-0002E6-1c for fwts-devel@lists.ubuntu.com; Mon, 06 May 2013 21:50:07 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: fwts_microcode: fix leak of allocated microcode buffer Date: Mon, 6 May 2013 22:50:06 +0100 Message-Id: <1367877006-16912-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.1.2 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: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Coverity CID #997340, Resource leak. Need to free microcode buffer before we return. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Keng-Yu Lin --- src/lib/src/fwts_microcode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/src/fwts_microcode.c b/src/lib/src/fwts_microcode.c index fb81c0c..0bcbc4b 100644 --- a/src/lib/src/fwts_microcode.c +++ b/src/lib/src/fwts_microcode.c @@ -54,6 +54,7 @@ int fwts_update_microcode(fwts_framework *fw, const char *device, const char *fi if ((fp = fopen(filename, "r")) == NULL) { fwts_log_error(fw, "Cannot open source '%s'.", filename); + free(microcode); return FWTS_ERROR; }