From nobody Sun Feb 8 23:06:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1614183550; cv=none; d=zohomail.com; s=zohoarc; b=mmNvGH+84FjyRIy5ITF9HCIBuj298i1pC7tumFWn2QxK2pAqmOOVOPxu1AbXqjT5f2XLH3+jvjfEde+8u7836Mw5jMXEBoirGX0ju1lmB2oy0purCNAFxC8uVkJizE53kvGmhY0/OCJBWJNhvAxfxP2VRLzyR8woOAhjtFyPAHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614183550; 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=4TJwGl7Boa1Aesk6A+wex8MBpFHwVLdPs+CXtphXldA=; b=LaG8XXMLRvgRIAi4GYmkS1YLFkXsej9yRLigQH3+SpWhpKUmDxqNmF980VRQWzvUNKJR+QczSVDk8V/5NNPDQUWZh5CeijuMG/EMoDixH1t2X1WlXV0/WtNcuJGIflhaBbzdJWvuI/4/WK2XnhldzOaNTyMiwqOGHAS/G8Ohdf4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1614183550074454.44056259306467; Wed, 24 Feb 2021 08:19:10 -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-154-J2nNQ3NuMjuq8c_mAebcbg-1; Wed, 24 Feb 2021 11:18:04 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED9B6801986; Wed, 24 Feb 2021 16:17:58 +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 C25DA19727; Wed, 24 Feb 2021 16:17:58 +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 89C5F18077D4; Wed, 24 Feb 2021 16:17:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11OGHqRn015784 for ; Wed, 24 Feb 2021 11:17:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDD2760CDE; Wed, 24 Feb 2021 16:17:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 530F4646DC for ; Wed, 24 Feb 2021 16:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614183549; 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=4TJwGl7Boa1Aesk6A+wex8MBpFHwVLdPs+CXtphXldA=; b=g3KsUYeN84Mu36e1BhMLnRB6ygEshttlRFAwRZ3DVcTirHeSrWZJxPVTr1Rlj5w9f3VO9g SkEO31qN5HqvvUWGv56GU+L6iPTgQDp72fcXpjaaAMC5tj5zeL9K9Rph4Mjk9toZoT5ffz L9NlVuNW4oouwyD/Ut/24RXlEw5f1wg= X-MC-Unique: J2nNQ3NuMjuq8c_mAebcbg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 24/33] virURIFormat: abort() on failure Date: Wed, 24 Feb 2021 17:16:59 +0100 Message-Id: <9b9592726573b3d19c7cf7f775d75ef2db3f2b33.1614182583.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.84 on 10.5.11.23 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If the argument of 'xmlSaveUri' is non-NULL the function returns NULL on OOM failure only. Thus we can directly abort rather than try to do the impossible recovery. Signed-off-by: Peter Krempa --- src/util/viruri.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/util/viruri.c b/src/util/viruri.c index 0aafd49d6d..1e8808ddc6 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -238,11 +238,9 @@ virURIFormat(virURIPtr uri) if (!xmluri.server && !xmluri.port) xmluri.port =3D -1; - ret =3D (char *)xmlSaveUri(&xmluri); - if (!ret) { - virReportOOMError(); - return NULL; - } + /* xmlSaveUri can fail only on OOM condition if argument is non-NULL */ + if (!(ret =3D (char *)xmlSaveUri(&xmluri))) + abort(); return ret; } --=20 2.29.2