From patchwork Mon Jun 28 21:55:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 12348577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87B56C11F64 for ; Mon, 28 Jun 2021 21:56:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA2D461CFC for ; Mon, 28 Jun 2021 21:56:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA2D461CFC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxzFL-0003Gv-Qv for qemu-devel@archiver.kernel.org; Mon, 28 Jun 2021 17:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxzEM-0002RX-JE; Mon, 28 Jun 2021 17:55:50 -0400 Received: from mout.gmx.net ([212.227.15.15]:42165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxzEJ-000712-8W; Mon, 28 Jun 2021 17:55:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1624917338; bh=UieFgS9HlL/FELTkvAw6BlIG2jZujhEQo+iLCZc1jBs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=fIuOdoHD9biMKlIRJrsbIBl3fGt129exanHHuehT4KABJ+mi6WH4yFKwV/79dDtXq +zufUO8qScUKaalqkXJ9zhJc4gLfb2CLpu25QhODEt85HLTUZnx0ceWgOJix/owUI9 o5YaJRrXESrGbVFfVR4WMZUBENNlluIGAbOtqyN8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([88.152.144.157]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1Mwfai-1l08ZP3zvm-00yDPn; Mon, 28 Jun 2021 23:55:38 +0200 From: Heinrich Schuchardt To: qemu-devel@nongnu.org Subject: [PATCH 1/1] util/uri: do not check argument of uri_free() Date: Mon, 28 Jun 2021 23:55:26 +0200 Message-Id: <20210628215526.50324-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:iWPvcRdo577CdT03QhIG9u9i9A6Bkbyflm9+o3HAbF1hFw8IfzU LJFUv0FZe7OpcVMGdaTog1BMIV17S1zRiIhtd1fIIBrjxYKztkewXF8ZogNNfSA3LEqwwL6 lOeRSCiYiLz61ognG7mcDWBSc32WLbEOsAcA9oEVEyh8kjnOht6srQs0Iuy/PUl11LqXPZ+ ZLg7+rrnc5xxF1rBWn9hA== X-UI-Out-Filterresults: notjunk:1;V03:K0:R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KQx2/tpaEdOeU0nt464i3IsTE2doUowoRyqbwZkTE2sQyHmVHdsU5QSy3Jmpjj8a+MFNt WU6BHmr5iNaptHwoTdTuRZgHeZFg7nWk7nd Received-SPF: pass client-ip=212.227.15.15; envelope-from=xypron.glpk@gmx.de; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Heinrich Schuchardt , Peter Lieven , "Richard W . M . Jones" , Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" uri_free() checks if its argument is NULL in uri_clean() and g_free(). There is no need to check the argument before the call. Signed-off-by: Heinrich Schuchardt --- block/nfs.c | 4 +--- block/ssh.c | 4 +--- capstone | 2 +- util/uri.c | 22 ++++++---------------- 4 files changed, 9 insertions(+), 23 deletions(-) -- 2.30.2 diff --git a/block/nfs.c b/block/nfs.c index 7dff64f489..9aeaefb364 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -147,9 +147,7 @@ out: if (qp) { query_params_free(qp); } - if (uri) { - uri_free(uri); - } + uri_free(uri); return ret; } diff --git a/block/ssh.c b/block/ssh.c index b51a031620..9f88480ae8 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -237,9 +237,7 @@ static int parse_uri(const char *filename, QDict *options, Error **errp) return 0; err: - if (uri) { - uri_free(uri); - } + uri_free(uri); return -EINVAL; } diff --git a/capstone b/capstone index f8b1b83301..31254f17e3 160000 --- a/capstone +++ b/capstone @@ -1 +1 @@ -Subproject commit f8b1b833015a4ae47110ed068e0deb7106ced66d +Subproject commit 31254f17e3c6025f3465d1c974a8c96e338ddbe0 diff --git a/util/uri.c b/util/uri.c index 8bdef84120..ff72c6005f 100644 --- a/util/uri.c +++ b/util/uri.c @@ -1340,7 +1340,7 @@ static void uri_clean(URI *uri) /** * uri_free: - * @uri: pointer to an URI + * @uri: pointer to an URI, NULL is ignored * * Free up the URI struct */ @@ -1939,15 +1939,9 @@ step_7: val = uri_to_string(res); done: - if (ref != NULL) { - uri_free(ref); - } - if (bas != NULL) { - uri_free(bas); - } - if (res != NULL) { - uri_free(res); - } + uri_free(ref); + uri_free(bas); + uri_free(res); return val; } @@ -2190,12 +2184,8 @@ done: if (remove_path != 0) { ref->path = NULL; } - if (ref != NULL) { - uri_free(ref); - } - if (bas != NULL) { - uri_free(bas); - } + uri_free(ref); + uri_free(bas); return val; }