From nobody Tue Feb 10 03:37:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1593056088; cv=none; d=zohomail.com; s=zohoarc; b=k19DKLbTZIQrwyljeK2duJ5eAVukMADv62yxxkFKxaGz1tifbkvSHn5z1K3mouauB+N+T9iWuY+c8gYjFenkc42nLTwRiX5Et4FimOq5cPB4tNtsdLqbV4NtVrMU2m4Zh665LxnUgfVSprq3HSPoIbFQqAY08AWyjqRNY3Uhou8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593056088; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3xtR1th8Jd6NJdozPgFZZq0l/kokW5PAuj+HJ5bQ3FE=; b=K0f6yWpJMKHWSszYiSojYC33yZCB/ebhNuvqJvFpEjEKuNPP+qt6o2wCUPyByWpzfTiNQb1PZDza6am4lU9u9g+ok2OBa7BpDkDjBjRPuGp6Ta4XozdZGwIn9Q+RQHBWDEYWxqUgZs2WvC4EFfegJgj4RXVyTNT1px3Jv/xnf7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1593056088103571.8135490129048; Wed, 24 Jun 2020 20:34:48 -0700 (PDT) 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-493-sKGdPBhLOGK7Ee9yFdj14w-1; Wed, 24 Jun 2020 23:34:36 -0400 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 275541800D4A; Thu, 25 Jun 2020 03:34:31 +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 04F2D196B6; Thu, 25 Jun 2020 03:34:31 +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 C98C31809563; Thu, 25 Jun 2020 03:34:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05P3YNZX007795 for ; Wed, 24 Jun 2020 23:34:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id E91175BAC0; Thu, 25 Jun 2020 03:34:23 +0000 (UTC) Received: from vhost2.laine.org (ovpn-114-28.phx2.redhat.com [10.3.114.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id A619C5BACC for ; Thu, 25 Jun 2020 03:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593056086; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3xtR1th8Jd6NJdozPgFZZq0l/kokW5PAuj+HJ5bQ3FE=; b=jB7ik38Ft/s1Zp66C3N0QYD0w+HqFWn6YdmitI2aZxhdKbOgOHdJVfeT7NM/6vxhqhHX2j QGkNf9Ld93b8+6noA0uGw4B41tY6I/OAaV06bPQyCrLYR+XaCNNJrmwQrvVBV6K79LStT2 jcNHFgFBy8boyAJJ6k279X69WtjQfqc= X-MC-Unique: sKGdPBhLOGK7Ee9yFdj14w-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 05/25] util: remove OOM error log from virGetHostnameImpl() Date: Wed, 24 Jun 2020 23:33:54 -0400 Message-Id: <20200625033414.1819594-6-laine@redhat.com> In-Reply-To: <20200625033414.1819594-1-laine@redhat.com> References: <20200625033414.1819594-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The strings allocated in virGetHostnameImpl() are all allocated via g_strdup(), which will exit on OOM anyway, so the call to virReportOOMError() is redundant, and removing it allows slight modification to the code, in particular the cleanup label can be eliminated. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/util/virutil.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index f39122e8dd..04f882fda7 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -503,8 +503,7 @@ virGetHostnameImpl(bool quiet) * string as-is; it's up to callers to check whether "localhost" * is allowed. */ - result =3D g_strdup(hostname); - goto cleanup; + return g_strdup(hostname); } =20 /* otherwise, it's a shortened, non-localhost, hostname. Attempt to @@ -519,8 +518,7 @@ virGetHostnameImpl(bool quiet) if (!quiet) VIR_WARN("getaddrinfo failed for '%s': %s", hostname, gai_strerror(r)); - result =3D g_strdup(hostname); - goto cleanup; + return g_strdup(hostname); } =20 /* Tell static analyzers about getaddrinfo semantics. */ @@ -538,10 +536,6 @@ virGetHostnameImpl(bool quiet) result =3D g_strdup(info->ai_canonname); =20 freeaddrinfo(info); - - cleanup: - if (!result) - virReportOOMError(); return result; } =20 --=20 2.25.4