From patchwork Mon May 6 23:56:12 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: 241850 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 18BE02C0113 for ; Tue, 7 May 2013 09:56:20 +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 1UZVGU-00064k-Lo; Mon, 06 May 2013 23:56:18 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UZVGP-00062T-4q for fwts-devel@lists.ubuntu.com; Mon, 06 May 2013 23:56:13 +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 1UZVGP-0006Xe-1V for fwts-devel@lists.ubuntu.com; Mon, 06 May 2013 23:56:13 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] uefi: uefidump: missing va_end on str == NULL return path Date: Tue, 7 May 2013 00:56:12 +0100 Message-Id: <1367884572-22996-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 #997322, Missing varargs init or cleanup (VARARGS) Coverity detected a missing va_end on the str == NULL error return path. Fix this by using va_end() immediately after we finish using args. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/uefi/uefidump/uefidump.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c index 771f904..fa914ba 100644 --- a/src/uefi/uefidump/uefidump.c +++ b/src/uefi/uefidump/uefidump.c @@ -60,8 +60,8 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...) char buffer[4096]; va_start(args, fmt); - vsnprintf(buffer, sizeof(buffer), fmt, args); + va_end(args); if (str == NULL) str = strdup(buffer); @@ -72,7 +72,6 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...) strcat(str, buffer); } - va_end(args); return str; }