From nobody Mon Feb 9 01:31:03 2026 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=1614183486; cv=none; d=zohomail.com; s=zohoarc; b=Y33ON0a8DJkok9Sy5LqC3ptheXEsak3EXRH+XDtecQanZpVls6w6yuOqLGLj0D8YClGtvSBK6RUnx8hzk5hQw8BJxXMdDEgSUz3ONVDuqhAitKxldmVDC+IiG4oIryt5KVCEfYvGSc6Sk0rF/jahneikv//twDm9xDoYGZPftA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614183486; 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=Q3OvWhXXHVDUUdhNqerIZissFzawip/yR/4xWQZGFsk=; b=hPHxeVEYKDkCKRPKgCg4cuORkH/AYSiWKMNQMOTzVtm768aNhDy8qmHDKmmPAD1uSretN527ieDabqOPezw5vawqUVC0q9aZM975SbSYBZTHKpMZMUgghlHYrwcmHlE0ca0zIIe/0Kn6nM4R/dLEhSiqCU1aFa62mm+o5EH7qBI= 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 1614183486150520.4623449461652; Wed, 24 Feb 2021 08:18:06 -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-73-lKCPy4RVMuu6zzMT4B4BDQ-1; Wed, 24 Feb 2021 11:18:02 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73E3D100CCC3; Wed, 24 Feb 2021 16:17:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51C5060CDE; Wed, 24 Feb 2021 16:17:54 +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 116CB5808E; Wed, 24 Feb 2021 16:17:54 +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 11OGHjdB015667 for ; Wed, 24 Feb 2021 11:17:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id BDCF960D79; Wed, 24 Feb 2021 16:17:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2043E60CDE for ; Wed, 24 Feb 2021 16:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614183485; 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=Q3OvWhXXHVDUUdhNqerIZissFzawip/yR/4xWQZGFsk=; b=VKpDroqZCFzV2N7IjOqpLhc3ZpiT33ZzLjzTG7nRXMluuZbjI4R9R/QILnoRQQFwc5xwMw AQaGyvt/RWeZX3ScZvmlmM+MsrPxXGIgd255LMav5fID9X2+yD80qUCYbk1/RWy+OFluG3 NqpXzfHkNnb8CXVBRHA6bbBPq5Hc0pk= X-MC-Unique: lKCPy4RVMuu6zzMT4B4BDQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/33] Don't report OOM error on xmlCopyNode failure Date: Wed, 24 Feb 2021 17:16:55 +0100 Message-Id: <526bb207189d67f239580834b73582305ebf5ebd.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.79 on 10.5.11.13 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" Out of memory isn't the only reason the function can fail. Add a message stating that copying of a XML node failed. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 3 ++- src/test/test_driver.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c0881608af..f1fd5320a5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30460,7 +30460,8 @@ virDomainDefSetMetadata(virDomainDefPtr def, def->metadata =3D virXMLNewNode(NULL, "metadata"); if (!(new =3D xmlCopyNode(doc->children, 1))) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); return -1; } } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index bca1297d1d..71ab04aa1a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -224,7 +224,8 @@ testDomainDefNamespaceParse(xmlXPathContextPtr ctxt, for (i =3D 0; i < n; i++) { xmlNodePtr newnode =3D xmlCopyNode(nodes[i], 1); if (!newnode) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); goto error; } @@ -787,7 +788,8 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *fi= le, const char *type) ret =3D xmlCopyNode(xmlDocGetRootElement(doc), 1); if (!ret) { - virReportOOMError(); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to copy XML node")); goto error; } xmlReplaceNode(node, ret); --=20 2.29.2