From nobody Sun Feb 8 16:05:48 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=1623141929; cv=none; d=zohomail.com; s=zohoarc; b=DjKJXd38iKtwYvYNE37AKqBy6vaV/DaXdXYi+ClTq/9JuHU94dd8rsaGxmP4rCNs5JpUMtSvUZJIUu3NURe6SLa6r4RWLOA3BItHCGERyYM7CqZgAJbhbbm4lKIAQ/o3VlHmjUSXcwAu4eAmQ0xRJK/asYA8UxV7ER+5gJV/ENA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623141929; 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=6URgwviM2K32ZHh3E6gTzSXht9io6FQg2fss/x/2KBE=; b=ARjR7FPlzHGpQTr0XvkoyA3Z00Ed6QpKvFFarax7L60V/ms1msXIP8OmYrQyyV1Lcega9uVVmwDcwDwjRkFGiBs1ITFrxJMDnhvBRj8RiwMJlmsdyv9/YKtcLHBiS6MQt6ZuidD4fOvnXFNtEFmFLpskjHGdFJHLERr3tOD4/vw= 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 1623141929567258.87202024467456; Tue, 8 Jun 2021 01:45:29 -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-77-QG_U6Li8OmSUbAWqPTCGpw-1; Tue, 08 Jun 2021 04:45:25 -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 AB52164149; Tue, 8 Jun 2021 08:45:19 +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 8537460C04; Tue, 8 Jun 2021 08:45:19 +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 01BB244A5B; Tue, 8 Jun 2021 08:45:19 +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 1588jHTK007043 for ; Tue, 8 Jun 2021 04:45:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 04D755D75A; Tue, 8 Jun 2021 08:45:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 784AE5D736 for ; Tue, 8 Jun 2021 08:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623141928; 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=6URgwviM2K32ZHh3E6gTzSXht9io6FQg2fss/x/2KBE=; b=gKBiVJo+GYMjf3VgZi5NOcc/sa9nbQNf/nXD3o0jdHTZHb2FdewEAmkgaM7CG+ICXMDgqC TIXLCPjOPrNw7FpjxDykzDF3A2g8OfRkjytPY8yRptzhKjU/CXEq29/uZi9uJuUCfMseAM ZuH+CPwjPpvdQBrh3pQdjZwbdv9M9Zo= X-MC-Unique: QG_U6Li8OmSUbAWqPTCGpw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/5] virt-host-validate: Initialize the error object Date: Tue, 8 Jun 2021 10:45:06 +0200 Message-Id: In-Reply-To: References: 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 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" Several libvirt functions are called from virt-host-validate. Some of these functions do report an error on failure. But reporting an error is coupled with freeing previous error (by calling virResetError()). But we've never called virErrorInitialize() and thus resetting error object frees some random pointer. Signed-off-by: Michal Privoznik --- tools/virt-host-validate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c index c119d649ce..806d61bc8e 100644 --- a/tools/virt-host-validate.c +++ b/tools/virt-host-validate.c @@ -27,6 +27,7 @@ #include =20 #include "internal.h" +#include "virerror.h" #include "virgettext.h" =20 #include "virt-host-validate-common.h" @@ -83,8 +84,11 @@ main(int argc, char **argv) bool quiet =3D false; bool usedHvname =3D false; =20 - if (virGettextInitialize() < 0) + if (virGettextInitialize() < 0 || + virErrorInitialize() < 0) { + fprintf(stderr, _("%s: initialization failed\n"), argv[0]); return EXIT_FAILURE; + } =20 while ((c =3D getopt_long(argc, argv, "hvq", argOptions, NULL)) !=3D -= 1) { switch (c) { --=20 2.31.1