From patchwork Fri Aug 5 10:03:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9265159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2544B60839 for ; Fri, 5 Aug 2016 10:16:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14183283E6 for ; Fri, 5 Aug 2016 10:16:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06E0228410; Fri, 5 Aug 2016 10:16:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3340283E6 for ; Fri, 5 Aug 2016 10:16:21 +0000 (UTC) Received: from localhost ([::1]:44162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVcAu-0004jD-O7 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 05 Aug 2016 06:16:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVbyL-0008EG-Fr for qemu-devel@nongnu.org; Fri, 05 Aug 2016 06:03:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVbyJ-0003ZQ-GB for qemu-devel@nongnu.org; Fri, 05 Aug 2016 06:03:20 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:58551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVbyJ-0003ZH-99 for qemu-devel@nongnu.org; Fri, 05 Aug 2016 06:03:19 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bVbyG-0007nU-B4; Fri, 05 Aug 2016 11:03:16 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 5 Aug 2016 11:03:12 +0100 Message-Id: <1470391392-28274-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] tests/hd-geo-test: Don't pass NULL to unlink() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The unlink() function doesn't accept a NULL pointer, so don't pass it one. Spotted by the clang sanitizer. Signed-off-by: Peter Maydell Reviewed-by: John Snow --- tests/hd-geo-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index 12ee392..6176e81 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -416,7 +416,9 @@ int main(int argc, char **argv) ret = g_test_run(); for (i = 0; i < backend_last; i++) { - unlink(img_file_name[i]); + if (img_file_name[i]) { + unlink(img_file_name[i]); + } } return ret;