From nobody Sat May 4 15:27:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533182827319988.5653284650977; Wed, 1 Aug 2018 21:07:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85F2D308FBA6; Thu, 2 Aug 2018 04:07:03 +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 C41EE62A11; Thu, 2 Aug 2018 04:07:00 +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 3AEE74A460; Thu, 2 Aug 2018 04:06:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7246trF023217 for ; Thu, 2 Aug 2018 00:06:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB905600C6; Thu, 2 Aug 2018 04:06:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B31A1600C4 for ; Thu, 2 Aug 2018 04:06:53 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 289F9308625F for ; Thu, 2 Aug 2018 04:06:52 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id z8-v6so881198qto.9 for ; Wed, 01 Aug 2018 21:06:52 -0700 (PDT) Received: from localhost.localdomain ([177.83.72.129]) by smtp.gmail.com with ESMTPSA id h4-v6sm289431qtp.53.2018.08.01.21.06.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 21:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=ykM8EtIltuesfL3g/CeRIoywAGhpNM08iFNeDN4gm/8=; b=nUcIq4wZvSw2FysOp1Fn2LS7EQVcNT6Y7n3DkgevLtjc1x7pVpIrTArSuUjEI08rYb OHq7Ag/I5va2/4vJn2IYTfPrti9gL8Z+MKMEeNuQK7XcBdvWi0Rg5w0Wdq2jRKgA+glD 7m1emPdIuhYV6DvrEZxfrLiYMZkUcU8mnSrd+QWkHApDo5zGgaWV/3J8HEgc6Bh5jZsQ DR5pWrZPPqR20XzJmco+4zL76mvVnxwEtL1pzAMNHDb+qXWGLTpf2OK16pcM5RaY1cVG 7rH0w7wfLT0NprNvWeOHGrbNGjWmiZXaddNOkZVVDfz1VjUGaN35lk43hZpu7DWuHoAx Nu9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=ykM8EtIltuesfL3g/CeRIoywAGhpNM08iFNeDN4gm/8=; b=kHX3LvFhr3kicNkIX/C/cNksPOD0/BzU+f6WBsrQKzz17oo9ISJmeCAg0xy6msurUs fF1v+N5zAvlyrLPqxfj8qC/ziXsfp36OPg989sYbt9aH92OCphQPhPS89zbe5fpDCil2 t0/TM5g/PxgYCd/s4y+aaVOPEmoYZ7R+1DZc/PFH1LyJLJzWNtFVL7Ubjfquiv8tDVkh i52N2pHM0IHV+Y7smAJFuU0VAtBV9FkGj8LkTN6oEJkEh6sBDxVU4x2CapGlYcP46k3B 5r8RMwPKaDih2GTWfYeScO5PiehBHgO0D3bexfSXBgHKq2nlmEliIqQtPnZsAHwnDQKd 6Gzg== X-Gm-Message-State: AOUpUlEUN16/DqcB9F5dMyxszxfSIG9D+z5pfKjqZuQ3zvCZAjVgUhW5 aMVI20VibzN+JU9HVY4RcW/Puoqg X-Google-Smtp-Source: AAOMgpeEpREr1Kl+gK4v32kn5AVKJCV5Snam8+N6J6YaEkpNN0nWe/Qxe98eSWKQ9Xb/Mk70O/rT+Q== X-Received: by 2002:a0c:ae71:: with SMTP id z46-v6mr1067652qvc.108.1533182811130; Wed, 01 Aug 2018 21:06:51 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Thu, 2 Aug 2018 01:06:39 -0300 Message-Id: <20180802040639.29731-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 02 Aug 2018 04:06:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 02 Aug 2018 04:06:52 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] tests: fix test segfault when libxl configuration setup fails. 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 02 Aug 2018 04:07:04 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit fixes a segmentation fault caused by missing conditional to check if libxl configuration was properly created by the test. If the configuration was not properly created, libxlDriverConfigNew() function will return NULL and cause a segfault at cfg->caps =3D NULL during the cleanup. Signed-off-by: Julio Faracco Reviewed-by: Erik Skultety --- tests/libxlxml2domconfigtest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 34a63e22b5..a9758c40cb 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -138,7 +138,8 @@ testCompareXMLToDomConfig(const char *xmlfile, libxl_domain_config_dispose(&actualconfig); libxl_domain_config_dispose(&expectconfig); xtl_logger_destroy(log); - cfg->caps =3D NULL; + if (cfg) + cfg->caps =3D NULL; virObjectUnref(cfg); return ret; } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list