From nobody Fri Mar 29 15:08:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605801751; cv=none; d=zohomail.com; s=zohoarc; b=PggB6GgyB40vJvpm1EjlrcA0XRoFfLrbZ/lTr0dASGfAMETh9g2riRm1IoNvd0kEBsufuusAdlW01M1INdqnokRuGZnjNOH/LWmuqDq7vVPFmp1vur7ZeUrz4t4QJ+ZMgLU9bHqE6RljuxLFLt0sYDEfxCmCVL5NRmKAAFRSC6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605801751; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=RQ3oxDAALpuz32p3ag4e9O41L2W+7136+d3tW83ooaA=; b=HxxPC36nP5Y1KQb1hyeIN2rIXvH3mFBtpIVQES2TnBcj50EKXRB4GF/KYEFiYvUV4mSpkFktMK/CnussM8CdqjrFbZ2l71m8hRhywK3Yh7XkAkPX/8DevF3+OhsNqFd01Gldf7YtMBBnsVvfxeis1/3Q2Pc8T/XSctpSqfr272E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605801751871732.6068339803619; Thu, 19 Nov 2020 08:02:31 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-Atx1FG7ePtC7pBTbua84tw-1; Thu, 19 Nov 2020 11:01:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 755AF835DE3; Thu, 19 Nov 2020 16:01:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B61260BE2; Thu, 19 Nov 2020 16:01:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AFE80180954D; Thu, 19 Nov 2020 16:01:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AJG1auh026042 for ; Thu, 19 Nov 2020 11:01:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id E8D3460C05; Thu, 19 Nov 2020 16:01:36 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4255E60BE2 for ; Thu, 19 Nov 2020 16:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605801708; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RQ3oxDAALpuz32p3ag4e9O41L2W+7136+d3tW83ooaA=; b=i5yUlks4hV0nm58BGnsvHpDez3ZFz9ADciy2rxRGBRCrAF77RxhcFT5mWAzcQoigRWcnzu 9zw4IS9y2Rbf6rNW+pDifdR+8/U4O/MYxy8r5ToojWKvRTseAU5Lq3mihy3tLeM9AAT2GY oxNznH7f5lUkDEZb5EHwGeIxsfHLsJU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605801750; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RQ3oxDAALpuz32p3ag4e9O41L2W+7136+d3tW83ooaA=; b=Mjq68Vej0M07oJ/iuZ2xVPiF6IAungNu25E/Wk1ilmjVzxec8Uvkg76LajuKiZtADV+vbb Z2J4woSpc68wr3fSnW+xj/nTqZ40I7tCRap7zBDhkXTuM8XXSaLGOSgawxMtIxizVgZd1U Fzh0XvDGOP3M0u7DOMGK/7A3Hqmsr2M= X-MC-Unique: Atx1FG7ePtC7pBTbua84tw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] sockettest: testMaskNetwork: use g_auto Date: Thu, 19 Nov 2020 17:01:31 +0100 Message-Id: <34ecb093d02623c2a06116aee225c73e9a3caa3d.1605801687.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) This has the added benefit of 'gotnet' only being freed after it was possibly used in the output string. ../src/internal.h:519:27: error: =E2=80=98%s=E2=80=99 directive argument is= null [-Werror=3Dformat-overflow=3D] 519 | # define fprintf(fh, ...) g_fprintf(fh, __VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../tests/sockettest.c:194:9: note: in expansion of macro =E2=80=98fprintf= =E2=80=99 194 | fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet= ); | ^~~~~~~ Signed-off-by: J=C3=A1n Tomko Reported-by: Jaroslav Suchanek Fixes: ba08c5932e556aa4f5101357127a6224c40e5ebe Reviewed-by: Daniel Henrique Barboza --- tests/sockettest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/sockettest.c b/tests/sockettest.c index 3183ca523f..e9654fcebb 100644 --- a/tests/sockettest.c +++ b/tests/sockettest.c @@ -175,7 +175,7 @@ static int testMaskNetwork(const char *addrstr, { virSocketAddr addr; virSocketAddr network; - char *gotnet =3D NULL; + g_autofree char *gotnet =3D NULL; =20 /* Intentionally fill with garbage */ memset(&network, 1, sizeof(network)); @@ -190,11 +190,9 @@ static int testMaskNetwork(const char *addrstr, return -1; =20 if (STRNEQ(networkstr, gotnet)) { - VIR_FREE(gotnet); fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet); return -1; } - VIR_FREE(gotnet); return 0; } =20 --=20 2.26.2