From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404000; cv=none; d=zohomail.com; s=zohoarc; b=Hd9RB0KMXoP6L0dl98joTZA6bDi6y2x1l6Yq7NOzJNDM2ISVrAB2yVuWiQ38lHJYKSjcKCg+pwCrQbW7btMB/KqBH3tXvc0UanqTXAoesmQo7okmJRzd27v2uzbaZBOkiRWwlpoqm4gIft/6QiJ+ckS7D3UBFEkjC+E/Vs4K028= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404000; 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=ZTHa5J3lKZfAETvn55YIcDT0R0CdUo/hMJ9WL5JrU8I=; b=buBC/nVLqf2qsQRqB+OJEUk2EuBLT838G8tba2Y3+sK/mhXBHYCdpjhGRMgFRtLPVc4PCEdbA66sgN0pLxxeUj3QS7s9znTolK2BMFi+zF08GGcScYRye6SwiKWBFTtWO7vC4aKx7VeMX70EH6Hto5bdV08PjkcKniAQ0YxVUsM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404000112216.95446948838412; Mon, 13 Dec 2021 06:00:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-527-RmzdKpfdOt2Og1clxRvVAA-1; Mon, 13 Dec 2021 08:59:56 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B9CC8015CD; Mon, 13 Dec 2021 13:59:50 +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 929825BE03; Mon, 13 Dec 2021 13:59:49 +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 AC7A04BB7C; Mon, 13 Dec 2021 13:59:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxkKk002503 for ; Mon, 13 Dec 2021 08:59:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id A5DD922E07; Mon, 13 Dec 2021 13:59:46 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CBFF16A31 for ; Mon, 13 Dec 2021 13:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639403998; 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=ZTHa5J3lKZfAETvn55YIcDT0R0CdUo/hMJ9WL5JrU8I=; b=ZajMD4+zE2KL60sfL++zJ1zXkRRL6H7jmAoy8TB0g7JrpIZdWp/6/1l6gCUHTwOwo6du8x lCHowoZreMGLqNnbAoIlaU8p3LX7ykHYBaEE3hBf7wbL5TiOLrelsY/Yk5GaUvu4KyZCsJ LggJtTwBWs5XCJugKNxxkO+LaniNxfE= X-MC-Unique: RmzdKpfdOt2Og1clxRvVAA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/14] bhyve: refactor virBhyveProbeGrubCaps Date: Mon, 13 Dec 2021 14:59:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404002130100004 Use g_auto and remove the 'ret' variable, as well as the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_capabilities.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index 5a0c6c2b77..ed0df35518 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -168,35 +168,27 @@ virBhyveDomainCapsBuild(struct _bhyveConn *conn, int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps) { - char *binary, *help; - virCommand *cmd; - int ret, exit; + g_autofree char *binary =3D NULL; + g_autofree char *help =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + int exit; =20 - ret =3D 0; *caps =3D 0; - cmd =3D NULL; - help =3D NULL; =20 binary =3D virFindFileInPath("grub-bhyve"); - if (binary =3D=3D NULL) - goto out; + if (!binary) + return 0; =20 cmd =3D virCommandNew(binary); virCommandAddArg(cmd, "--help"); virCommandSetOutputBuffer(cmd, &help); - if (virCommandRun(cmd, &exit) < 0) { - ret =3D -1; - goto out; - } + if (virCommandRun(cmd, &exit) < 0) + return -1; =20 if (strstr(help, "--cons-dev") !=3D NULL) *caps |=3D BHYVE_GRUB_CAP_CONSDEV; =20 - out: - VIR_FREE(help); - virCommandFree(cmd); - VIR_FREE(binary); - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404000; cv=none; d=zohomail.com; s=zohoarc; b=GW6AVXeJHR9X4WpG46lAvK6XD+xRaj1jRt2mJjcbzE0/2rJV8fQF/OjLRFsYEbeJQg5oXVgedF8yKtwKdDSmTtyM9TuOgxO2UnLPLagsNZwcehrq/WDv7ULmKLRAh/i5Ix7lcOsQDbGhvMzZNh8WMVddMTVsSXcgBwOgiwGQmdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404000; 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=RrBt4B5L1JgKCMNiwx6BclNR0bClNlRaz04p43pnC+o=; b=Wj1s0Ci1Q16JNbx+aCCWXtX9Q9XIdOmusb/UgDzOsYSPTMWrNxvptLy2KMJSbMqsHEheK3IFPHRkOomP9rcixtvxdwJEzfUdtXHBx8RJ6s99mYT/8AAHh2YZ/0VQ0F4sYcHmRCkitCNI7s53DURh9m4qK+M0nt9ZCttRk83HcWs= 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) 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 1639404000453920.8629261080714; Mon, 13 Dec 2021 06:00:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-150-Le0NDl1nP5SGZ5GV6BzRug-1; Mon, 13 Dec 2021 08:59:55 -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 6D1C919253E8; Mon, 13 Dec 2021 13:59:51 +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 4A40316A31; Mon, 13 Dec 2021 13:59:51 +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 E7BEF4A7C9; Mon, 13 Dec 2021 13:59:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxlhq002510 for ; Mon, 13 Dec 2021 08:59:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7934522DFE; Mon, 13 Dec 2021 13:59:47 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00A1016A32 for ; Mon, 13 Dec 2021 13:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639403999; 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=RrBt4B5L1JgKCMNiwx6BclNR0bClNlRaz04p43pnC+o=; b=NYG4ncptcREDa3qah5p4YE2s5+IL2AOLGy7TvZzXr7WFDDmtB7b8c+8vmH5wOh3Q9t43Pu t32QsFutaW2RhSndA2PnlzeuVGP23SudBwJJddiNoCYHEtWwHGhTaxUwFKy/rHmHjG6bCF YUE/3V4zPYdxYIf1RSW48f22cbZfjjk= X-MC-Unique: Le0NDl1nP5SGZ5GV6BzRug-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/14] bhyve: refactor bhyveProbeCapsDeviceHelper Date: Mon, 13 Dec 2021 14:59:31 +0100 Message-Id: <3a92c405672a077a6df7db753256ecde3e9543f7.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404002283100006 Use g_auto and remove the 'ret' variable, as well as the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_capabilities.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index ed0df35518..421d0622cd 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -199,24 +199,20 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps, const char *errormsg, unsigned int flag) { - char *error; - virCommand *cmd =3D NULL; - int ret =3D -1, exit; + g_autofree char *error =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + int exit; =20 cmd =3D virCommandNew(binary); virCommandAddArgList(cmd, bus, device, NULL); virCommandSetErrorBuffer(cmd, &error); if (virCommandRun(cmd, &exit) < 0) - goto cleanup; + return -1; =20 if (strstr(error, errormsg) =3D=3D NULL) *caps |=3D flag; =20 - ret =3D 0; - cleanup: - VIR_FREE(error); - virCommandFree(cmd); - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404028; cv=none; d=zohomail.com; s=zohoarc; b=AZmrbTjXO1sQBUKys2U1vBtB/EWWDPtvhPDclSw/bQOLlVX6/LnEZlV/6Z36wTkqJ843D9g7hO/PICp3x+nXud5DpUy30n98iey9q8TEBIGquZ3k72kvyQqqppdbth3AnxrUmlvTkJfBuluO06gbamHkGoIdig5TwFeshSy75cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404028; 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=UhiTIQrxea83O8mCcbgYTjuIHVCXNuGZTU0JpDeo+9M=; b=T0Zi1oNJ3z3ibp2Vq054SJmQVVJF4P+w+1suFApnqKUiK1jWpKKmMClc13yHgz1MiO7KYA59i73RSa7pDVyrVzKLDBK5VR/zlJdfFMj6yNgpfbrpU7AiVSxlkNjom30dFKdwZfLLwWa1/vo26T10/2XoA4dRuzifhHFyhsOmgMY= 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) 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 1639404028397311.4462952488466; Mon, 13 Dec 2021 06:00:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-2wM0FQ2SNaWdBvsPwE31aA-1; Mon, 13 Dec 2021 09:00:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3303519253CC; Mon, 13 Dec 2021 14:00:01 +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 0FB2E45D89; Mon, 13 Dec 2021 14:00:01 +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 D51461802E2A; Mon, 13 Dec 2021 14:00:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxmI7002518 for ; Mon, 13 Dec 2021 08:59:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4D06222DFE; Mon, 13 Dec 2021 13:59:48 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C872416A31 for ; Mon, 13 Dec 2021 13:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404027; 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=UhiTIQrxea83O8mCcbgYTjuIHVCXNuGZTU0JpDeo+9M=; b=ZwHbp80LBcDMcbU0jnJ35ePGWWYPT3mFlSDYyvLcN/PMYjs3i23Lh/gh6qKwf3vM36DYQ9 MenylwtFTo+iDIFAdkPUsvAgHOOKAH5Advdw9M4QJuC5W/+GGEDjLdbF8IW1QCC776J5QU VNdjuA+WPMrJmdslEHKet09G5SH+zbo= X-MC-Unique: 2wM0FQ2SNaWdBvsPwE31aA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/14] bhyve: refactor bhyveProbeCapsFromHelp Date: Mon, 13 Dec 2021 14:59:32 +0100 Message-Id: <114fbd75a14c375bcc1536f98d9d3fca4129de05.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404036607100001 Use g_auto and remove the 'ret' variable, as well as the out label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_capabilities.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index 421d0622cd..b065256cf0 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -218,17 +218,15 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps, static int bhyveProbeCapsFromHelp(unsigned int *caps, char *binary) { - char *help; - virCommand *cmd =3D NULL; - int ret =3D 0, exit; + g_autofree char *help =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + int exit; =20 cmd =3D virCommandNew(binary); virCommandAddArg(cmd, "-h"); virCommandSetErrorBuffer(cmd, &help); - if (virCommandRun(cmd, &exit) < 0) { - ret =3D -1; - goto out; - } + if (virCommandRun(cmd, &exit) < 0) + return -1; =20 if (strstr(help, "-u:") !=3D NULL) *caps |=3D BHYVE_CAP_RTC_UTC; @@ -239,10 +237,7 @@ bhyveProbeCapsFromHelp(unsigned int *caps, char *binar= y) if (strstr(help, "-c vcpus") =3D=3D NULL) *caps |=3D BHYVE_CAP_CPUTOPOLOGY; =20 - out: - VIR_FREE(help); - virCommandFree(cmd); - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404092; cv=none; d=zohomail.com; s=zohoarc; b=Ws7Z0LIS0FSKz42uRL6nNsEH+WxyRSvQ+y827Ka1f4zhb6DDyXPtDV1313ePmk2bOhP5yLXjpSIlwkRditKaCOTjPdt80/jJpDe9jQJXBJDQJce7TYekeCLYF4XzsMwwmTW2kfq6oXNvAq3go/49/1T4LUFqVJcIDwt8kwfw25s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404092; 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=SYnytbAX0l5Ir9/7yePrOHatzNbekdlMFiCpRV33nHA=; b=BC6idcE6AENwXdSAPpIiq1ApFPVtSj3ppMxWqcW6QRJD1MR54kzISjJWNVSQDn/G5i53lMfE8oJtrEYCOTbPUqYEaLqNelOrkapIgrOaXv/dy3Cbg8ueL8QLXdaENQDtOyKyzWSfkTyyNvXA+5bf5UdYkuUR+GSTqGBoeGHQXtE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16394040925591012.0984026865864; Mon, 13 Dec 2021 06:01:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-436-qwEyC1H1ONWxKLktjkCcng-1; Mon, 13 Dec 2021 09:00:25 -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 DB79C1DDF1; Mon, 13 Dec 2021 14:00:00 +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 BF630709AA; Mon, 13 Dec 2021 14:00: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 923A81802FEB; Mon, 13 Dec 2021 14:00:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxnqW002525 for ; Mon, 13 Dec 2021 08:59:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2578B22E00; Mon, 13 Dec 2021 13:59:49 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E07622DFC for ; Mon, 13 Dec 2021 13:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404091; 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=SYnytbAX0l5Ir9/7yePrOHatzNbekdlMFiCpRV33nHA=; b=VQsKsV/1lkaQN51V8XcQx9Roz80UWoBQTzyWtZZkgErEBIFRuiw4VRiHrhHVkpl0+ISlJm ksAnSwpohykAnOhCNTMmusUpBgJN66az9vTjRzpLsJRkfqrY4+AW6FG9ZZeX7mlQT1LY4f KRL36lJBYeDD3FmmER/gvYGxhzs/cxA= X-MC-Unique: qwEyC1H1ONWxKLktjkCcng-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/14] bhyve: refactor bhyveConnectDomainXMLToNative Date: Mon, 13 Dec 2021 14:59:33 +0100 Message-Id: <16df61fe0afb0bd1d5a905ebc24906aeeab8d038.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404115313100001 Use g_auto and remove the ret variable, as well as the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_driver.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 21407a3957..f291f12e50 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -671,27 +671,26 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn, g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; struct _bhyveConn *privconn =3D conn->privateData; g_autoptr(virDomainDef) def =3D NULL; - virCommand *cmd =3D NULL; - virCommand *loadcmd =3D NULL; - char *ret =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virCommand) loadcmd =3D NULL; =20 virCheckFlags(0, NULL); =20 if (virConnectDomainXMLToNativeEnsureACL(conn) < 0) - goto cleanup; + return NULL; =20 if (STRNEQ(format, BHYVE_CONFIG_FORMAT_ARGV)) { virReportError(VIR_ERR_INVALID_ARG, _("Unsupported config type %s"), format); - goto cleanup; + return NULL; } =20 if (!(def =3D virDomainDefParseString(xmlData, privconn->xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACTIV= E))) - goto cleanup; + return NULL; =20 if (bhyveDomainAssignAddresses(def, NULL) < 0) - goto cleanup; + return NULL; =20 if (def->os.bootloader =3D=3D NULL && def->os.loader) { @@ -699,35 +698,30 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn, if (!virDomainDefHasOldStyleROUEFI(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Only read-only pflash is supported.")); - goto cleanup; + return NULL; } =20 if ((bhyveDriverGetBhyveCaps(privconn) & BHYVE_CAP_LPC_BOOTROM) = =3D=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " "bootrom")); - goto cleanup; + return NULL; } } else { if (!(loadcmd =3D virBhyveProcessBuildLoadCmd(privconn, def, "", NULL))) - goto cleanup; + return NULL; =20 virCommandToStringBuf(loadcmd, &buf, false, false); virBufferAddChar(&buf, '\n'); } =20 if (!(cmd =3D virBhyveProcessBuildBhyveCmd(privconn, def, true))) - goto cleanup; + return NULL; =20 virCommandToStringBuf(cmd, &buf, false, false); =20 - ret =3D virBufferContentAndReset(&buf); - - cleanup: - virCommandFree(loadcmd); - virCommandFree(cmd); - return ret; + return virBufferContentAndReset(&buf); } =20 static int --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404043; cv=none; d=zohomail.com; s=zohoarc; b=f2GiE/qXeNp6mS72Wo9MEYH7rcdZpnVLXEFTQnzrTDTsd0tvM0NelMLw8ig79YU7W5Zgv9ZIOZZ/hQ/lI39Q+RosT7HimA3muBwq38CarIT8kBMrMPDo8uXYGJzAejFcWBVUkp7vPKAX/v/qCYTVdOmpemvTSSAuStDcN3WNfx0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404043; 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=Aey/HxWnO/59mmajPlBH7knrgUhlHw5bI87fZqkqDeA=; b=MoQgY3MXtvHMhFp/rwlmu4ldBAOKj27QLvTM5ct2bVCCYwyshtQsMbVJs4c9LXwwfO89/R0wL+sc8QWzrUnpVKBe5L9v2G/zQBj+0Fz9foc1ZiS++bcpL7GFW2T5NtrnMOQx2FZWuTKGbi/uUynPLIIfuZL2P4/OMdpJb57BYNE= 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) 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 16394040432341003.4380217135513; Mon, 13 Dec 2021 06:00:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-560-MSllikTwOyGOxWm4nL7rog-1; Mon, 13 Dec 2021 09:00:28 -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 3F732344BC; Mon, 13 Dec 2021 14:00:04 +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 E466016A32; Mon, 13 Dec 2021 14:00:03 +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 81ACE4A706; Mon, 13 Dec 2021 14:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxnNm002530 for ; Mon, 13 Dec 2021 08:59:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC2A916A33; Mon, 13 Dec 2021 13:59:49 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 738B416A32 for ; Mon, 13 Dec 2021 13:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404042; 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=Aey/HxWnO/59mmajPlBH7knrgUhlHw5bI87fZqkqDeA=; b=gPMCJKQ5E0t9Ai5+aYVm2WqBKJo9q7t6QXm0tD1QdGp733SOLf7+a83xqpbuUiWhRyMb74 syV5LqbkcRTUY+JFjsXAvcfvrgt0bVVfl1HWnJ/CN+M8Afob4fZQkIwbiPNvsinUnhmyX9 s90MFCgDXoFVKPuOz1dprlrDOyRXSCI= X-MC-Unique: MSllikTwOyGOxWm4nL7rog-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/14] bhyve: use g_auto in virBhyveProcessStartImpl Date: Mon, 13 Dec 2021 14:59:34 +0100 Message-Id: <888d38580225d411db494e5bf161346f46af4532.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404053826100003 Use g_auto and VIR_AUTOCLOSE where possible. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_process.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 8de5fe4838..ead6b0e522 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -116,12 +116,12 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver, virDomainObj *vm, virDomainRunningReason reason) { - char *devmap_file =3D NULL; - char *devicemap =3D NULL; - char *logfile =3D NULL; - int logfd =3D -1; - virCommand *cmd =3D NULL; - virCommand *load_cmd =3D NULL; + g_autofree char *devmap_file =3D NULL; + g_autofree char *devicemap =3D NULL; + g_autofree char *logfile =3D NULL; + VIR_AUTOCLOSE logfd =3D -1; + g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virCommand) load_cmd =3D NULL; bhyveDomainObjPrivate *priv =3D vm->privateData; int ret =3D -1, rc; =20 @@ -227,28 +227,21 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver, if (rc < 0 && errno !=3D ENOENT) virReportSystemError(errno, _("cannot unlink file '%s'"), devmap_file); - VIR_FREE(devicemap); } - VIR_FREE(devmap_file); =20 if (ret < 0) { int exitstatus; /* Needed to avoid logging non-zero status */ - virCommand *destroy_cmd; + g_autoptr(virCommand) destroy_cmd =3D NULL; if ((destroy_cmd =3D virBhyveProcessBuildDestroyCmd(driver, vm->def)) !=3D N= ULL) { virCommandSetOutputFD(load_cmd, &logfd); virCommandSetErrorFD(load_cmd, &logfd); ignore_value(virCommandRun(destroy_cmd, &exitstatus)); - virCommandFree(destroy_cmd); } =20 bhyveNetCleanup(vm); } =20 - virCommandFree(load_cmd); - virCommandFree(cmd); - VIR_FREE(logfile); - VIR_FORCE_CLOSE(logfd); return ret; } =20 --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404050; cv=none; d=zohomail.com; s=zohoarc; b=VW6AxbYTIyC6gtXVco/M6q/oeLjgzHkRlhJfKrvnNYJbllEeq3GYvWCB82ZVTSayb+446AQ3iPQCyfUulfdeALa7DefW7jKWLu5+/5JAM0iYVWedp/iaEMzOzR4mHVeQ/ML0VvbxeIJSZz/5nYC35+V0x+PepNg4U9eUgtc9eJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404050; 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=mRas50neOvPUR/EIosoL+htAUX+Q9qU6UM4XN2Xu1eU=; b=ZCTAlUaOMY7S6ahAZh4qpQY/6DYcpSEbYvZSE94UXNLsGnne5u8qzlpbB1KkWi5IarH3+ObYc/lOquzS31G4V/vzHO4tTXBY+iKQJx6Q4D2keFpfUyASGN2v8k+E/XyENT5yC0IDXHjWmqfvcPnLKP7eHV16JP5AxrM07wboREk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404050195662.273493583326; Mon, 13 Dec 2021 06:00:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-75-ZGfqLPnfNiC3YlXrIy-kZw-1; Mon, 13 Dec 2021 09:00:36 -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 B0798100CFBD; Mon, 13 Dec 2021 14:00:07 +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 85CEE22DFC; Mon, 13 Dec 2021 14:00:07 +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 4BD074A70D; Mon, 13 Dec 2021 14:00:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxotH002540 for ; Mon, 13 Dec 2021 08:59:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id C740B22DFF; Mon, 13 Dec 2021 13:59:50 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4862E22DFC for ; Mon, 13 Dec 2021 13:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404049; 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=mRas50neOvPUR/EIosoL+htAUX+Q9qU6UM4XN2Xu1eU=; b=TCYnb9nbmuG+mviz+c14OhGu7jLac1dPNrkw+aISslf2pux2MJPyZnmX9MqI2eju1xbwk3 wvpFQek4LcjcR8NlRPun8LA3HuVDFpwDrHsG+9VKa2DHGLyHl5eHNKwUsc6oupFZHJqtPN H+2OK3815ejZ88jXi6XCJy/zyqZjiu8= X-MC-Unique: ZGfqLPnfNiC3YlXrIy-kZw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/14] bhyve: use g_auto in virBhyveProcessStop Date: Mon, 13 Dec 2021 14:59:35 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404061045100009 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index ead6b0e522..ee692d2ba3 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -285,7 +285,7 @@ virBhyveProcessStop(struct _bhyveConn *driver, virDomainShutoffReason reason) { int ret =3D -1; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; bhyveDomainObjPrivate *priv =3D vm->privateData; =20 if (!virDomainObjIsActive(vm)) { @@ -335,8 +335,6 @@ virBhyveProcessStop(struct _bhyveConn *driver, bhyveProcessStopHook(vm, VIR_HOOK_BHYVE_OP_RELEASE); =20 cleanup: - virCommandFree(cmd); - virPidFileDelete(BHYVE_STATE_DIR, vm->def->name); virDomainDeleteConfig(BHYVE_STATE_DIR, NULL, vm); =20 --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404042; cv=none; d=zohomail.com; s=zohoarc; b=mAN9p9jCI+lTPAf5OzvSQlkWOajIyEESNH0gK0D/vKQHSxxzmEQlAUwWjxIYNfIcxDEWJOj71syZ4a5AiFaFtjV1f+ivQdHM2bPY8w+pybuDuBCi1OLjMEwjAvWg+5J5eLCIjIhBxsX/LdVSS1nAfPYMTJzWL3SqUsx+u9yeHE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404042; 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=FVv/LjLhr2b9PtB2iN5ihDTZC4elAyrP7tniatzCYeA=; b=LIkx0RpRLeNSaDx2tQ6aJ1Xp+jyo2ihjaiaLfROHXBH7MvMA4Zaw25dICvRR4on7Gh0PljDltG+RRj3D8YLv8QLS918ZbP0ac4xoiubaIm1U5NewHwvBRQmAWRJkUjLkI3OqR9l7n+zDrn3SatKoq2ea9t/BtxK2hz7ASNAwPgo= 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) 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 1639404042268811.8299556532934; Mon, 13 Dec 2021 06:00:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-104-RF41tKGoOBeeXsTFrXCeJQ-1; Mon, 13 Dec 2021 09:00:33 -0500 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 83CA91926DA1; Mon, 13 Dec 2021 14:00:11 +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 1BA6B61093; Mon, 13 Dec 2021 14:00:11 +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 A46CC1802E2D; Mon, 13 Dec 2021 14:00:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxpdL002555 for ; Mon, 13 Dec 2021 08:59:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9C78B22DFE; Mon, 13 Dec 2021 13:59:51 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2323C22E05 for ; Mon, 13 Dec 2021 13:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404041; 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=FVv/LjLhr2b9PtB2iN5ihDTZC4elAyrP7tniatzCYeA=; b=GpHnoeQTbtXuMzOxCxIYGDqgNJK2MGdVCTfnEDCmFEnIwhGdSF+klqjVGjCgCeLLKNW2qd 28/SYe8K8Pn5npFwjohmEGXDLqz8itD8g+QBxVyshrk+0QalaTuxWg9tZSscSJsaxVt9ZS 3Z7YeQWiSc+F+ZHVPTEvMTXy9lrx1KM= X-MC-Unique: RF41tKGoOBeeXsTFrXCeJQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/14] bhyve: refactor virBhyveProcessBuildBhyveCmd Date: Mon, 13 Dec 2021 14:59:36 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404052268100001 Use automatic cleanup for virCommand, steal it on success and remove the error label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_command.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index cf858dfcd6..3368d20a04 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -649,7 +649,7 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver,= virDomainDef *def, * -S 31,uart,stdio \ * vm0 */ - virCommand *cmd =3D virCommandNew(BHYVE); + g_autoptr(virCommand) cmd =3D virCommandNew(BHYVE); size_t i; unsigned nusbcontrollers =3D 0; unsigned nisacontrollers =3D 0; @@ -661,14 +661,14 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *drive= r, virDomainDef *def, if (def->cpu->dies !=3D 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Only 1 die per socket is supported")); - goto error; + return NULL; } if (nvcpus !=3D def->cpu->sockets * def->cpu->cores * def->cpu->th= reads) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Invalid CPU topology: total number of vCPUs " "must equal the product of sockets, cores, " "and threads")); - goto error; + return NULL; } =20 if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_CPUTOPOLOGY) !=3D= 0) { @@ -681,7 +681,7 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver,= virDomainDef *def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " "defining CPU topology")); - goto error; + return NULL; } } else { virCommandAddArgFormat(cmd, "%d", nvcpus); @@ -716,14 +716,14 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *drive= r, virDomainDef *def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " "UTC clock")); - goto error; + return NULL; } break; default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported clock offset '%s'"), virDomainClockOffsetTypeToString(def->clock.offset= )); - goto error; + return NULL; } =20 /* Clarification about -H and -P flags from Peter Grehan: @@ -751,7 +751,7 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver,= virDomainDef *def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " "UEFI loader")); - goto error; + return NULL; } } =20 @@ -759,26 +759,26 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *drive= r, virDomainDef *def, for (i =3D 0; i < def->ncontrollers; i++) { if (bhyveBuildControllerArgStr(def, def->controllers[i], driver, c= md, &nusbcontrollers, &nisacontrollers)= < 0) - goto error; + return NULL; } for (i =3D 0; i < def->nnets; i++) { if (bhyveBuildNetArgStr(def, def->nets[i], driver, cmd, dryRun) < = 0) - goto error; + return NULL; } for (i =3D 0; i < def->ndisks; i++) { if (bhyveBuildDiskArgStr(def, def->disks[i], cmd) < 0) - goto error; + return NULL; } =20 if (def->ngraphics && def->nvideos) { if (def->ngraphics =3D=3D 1 && def->nvideos =3D=3D 1) { if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->video= s[0], driver, cmd, dryRun) < 0) - goto error; + return NULL; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Multiple graphics devices are not supported"= )); - goto error; + return NULL; } } =20 @@ -786,16 +786,16 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *drive= r, virDomainDef *def, if (bhyveBuildSoundArgStr(def, def->sounds[i], virDomainDefFindAudioByID(def, def->soun= ds[i]->audioId), driver, cmd) < 0) - goto error; + return NULL; } =20 for (i =3D 0; i < def->nfss; i++) { if (bhyveBuildFSArgStr(def, def->fss[i], cmd) < 0) - goto error; + return NULL; } =20 if (bhyveBuildConsoleArgStr(def, cmd) < 0) - goto error; + return NULL; =20 if (def->namespaceData) { bhyveDomainCmdlineDef *bhyvecmd; @@ -811,11 +811,7 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver= , virDomainDef *def, =20 virCommandAddArg(cmd, def->name); =20 - return cmd; - - error: - virCommandFree(cmd); - return NULL; + return g_steal_pointer(&cmd); } =20 virCommand * --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404098; cv=none; d=zohomail.com; s=zohoarc; b=avEvqCeAqfzsKQ7UG1Xt6NywUo7kuH0quFclEvvRuHfMEU5+V/4cuCXh/pSY64H2wgOoirhNyxJ7SqfLA7QADsWvvx87R1ifEzD5UEkH4SRkDNCr2dCLbpMbEnRV8KYsOSCckl1HbCbXC1xl5+gJZFKMXIXMeuzlgVQErKebWfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404098; 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=roJhqMkRtpLCskQlQ95s3e4EZru188WOwJ67UPPFMf8=; b=FFLqnMPtAUAjXi9CuT6zAGctoq4baygBDzYrkA65WyBFvBoRvUWWRJmp97GcG3RrCWQ16ZVo4+LivMucNscuHQKIydqQqIwGWLA5pyT4IP0HXZVjk4WYSfgwZRk1ZdJEE6fXFixRhj4g3Lwz8tFqZAmZA8OShxJYjP22z7+mFrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404098807261.4596895710042; Mon, 13 Dec 2021 06:01:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-Kgr-vinlP9SV2Ty_pLL_Gg-1; Mon, 13 Dec 2021 09:00:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32C3E835E35; Mon, 13 Dec 2021 14:00:04 +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 13AB545D92; Mon, 13 Dec 2021 14:00:04 +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 CAC8D1802E2D; Mon, 13 Dec 2021 14:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxquo002565 for ; Mon, 13 Dec 2021 08:59:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7131A16A33; Mon, 13 Dec 2021 13:59:52 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB3FE16A31 for ; Mon, 13 Dec 2021 13:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404097; 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=roJhqMkRtpLCskQlQ95s3e4EZru188WOwJ67UPPFMf8=; b=cUeBKwVTKqAhwvDCx/PRhh4jivwgJrgvVVPcEO0X1nMoTOVJkayhwfi/00WI98hyP9NwGd Il5SY+ILSgn0pjZBhifPAUIPew6GxahXFJPW219z5HEj1XgHEGCu4FrT+2XtImh3Py/QSw bGr3Kaq8RExByAHBmzQUvWiMZnbIaJU= X-MC-Unique: Kgr-vinlP9SV2Ty_pLL_Gg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/14] lxc: use g_auto in lxcContainerChild Date: Mon, 13 Dec 2021 14:59:37 +0100 Message-Id: <84fa43ad15e85a33a3a8acc9164e4b7a967b752d.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404122828100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/lxc/lxc_container.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 1d5b9bf429..3f38c55fc6 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1927,7 +1927,7 @@ static int lxcContainerChild(void *data) int ret =3D -1; g_autofree char *ttyPath =3D NULL; virDomainFSDef *root; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; int hasReboot; g_autofree gid_t *groups =3D NULL; int ngroups; @@ -2075,7 +2075,6 @@ static int lxcContainerChild(void *data) virGetLastErrorMessage()); } =20 - virCommandFree(cmd); return ret; } =20 --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404059; cv=none; d=zohomail.com; s=zohoarc; b=QMf0m+uHt02OB3mjiEyiV+ij5FSfWVyjPU3vIlGzrusMoHT+FMCJvZfcw0JJB32QJqPwwHVHZLZptJHjWJr72uoMt/alYF1EfodVQoHWrmj/VWGzcWqx7G8ae+vhs3la9zlY5/bN5Ul5F5EckSXtY7EJ9ff6cokbNiMxXqE+PZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404059; 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=GzSL9sY5HfhAj803COkGGWSB1+tSorCg3g3i54gkO3E=; b=OwtQPllL6wfbWF3BcT70X03tdJkOH57r4lzVoPfCNiTtdW3Fcg80pPYDR7HNFdG6iGL6kct70zrmL8vmNQlU8blGZvUa5gkiU+0QthZTEVHUbagKOB+lOVw+vGgKRSrwOX3kVxEigOzGozft0unp7fzqrb/Mr49hhQqCqmCizRk= 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) 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 1639404059690538.5828677688966; Mon, 13 Dec 2021 06:00:59 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-ILiWO55aPACjM5Y9mREU5Q-1; Mon, 13 Dec 2021 09:00:54 -0500 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 31B1A8015CD; Mon, 13 Dec 2021 14:00:17 +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 110BA610AE; Mon, 13 Dec 2021 14:00:17 +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 D71804A717; Mon, 13 Dec 2021 14:00:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxroF002572 for ; Mon, 13 Dec 2021 08:59:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 44EE316A31; Mon, 13 Dec 2021 13:59:53 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF4E016A32 for ; Mon, 13 Dec 2021 13:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404058; 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=GzSL9sY5HfhAj803COkGGWSB1+tSorCg3g3i54gkO3E=; b=Oyy9Wmzh+R4iRnxMvFcX31Omi/Pi5Uclp8t/+m8hwWjnkpNpZ8jpNu75HY+T7v6pJ6zsl9 t3gASoeWWeZsg4xvJTgolNj8t0OYl3JlAfeBpI/zg/tq+B6jf5g8nc00xqC03sZ+rBMJFN L1Sil41hWOczySCHXqgArBCOVevtmI0= X-MC-Unique: ILiWO55aPACjM5Y9mREU5Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/14] lxc: refactor virLXCProcessBuildControllerCmd Date: Mon, 13 Dec 2021 14:59:38 +0100 Message-Id: <66146b194b7d3b4d86afe9c5357d597de1cc2aaa.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404072463100003 Use automatic cleanup and remove the labels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/lxc/lxc_process.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 625208c86b..118d9cbdcc 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -935,7 +935,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver, size_t i; g_autofree char *filterstr =3D NULL; g_autofree char *outputstr =3D NULL; - virCommand *cmd; + g_autoptr(virCommand) cmd =3D NULL; g_autoptr(virLXCDriverConfig) cfg =3D virLXCDriverGetConfig(driver); =20 cmd =3D virCommandNew(vm->def->emulator); @@ -955,7 +955,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver, if (cfg->log_libvirtd) { if (virLogGetNbOutputs() > 0) { if (!(outputstr =3D virLogGetOutputs())) - goto error; + return NULL; =20 virCommandAddEnvPair(cmd, "LIBVIRT_LOG_OUTPUTS", outputstr); } @@ -1007,12 +1007,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver, * write the live domain status XML with the PID */ virCommandRequireHandshake(cmd); =20 - cleanup: - return cmd; - error: - virCommandFree(cmd); - cmd =3D NULL; - goto cleanup; + return g_steal_pointer(&cmd); } =20 =20 --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404024; cv=none; d=zohomail.com; s=zohoarc; b=QoTTFShiZ7LMH6uz7K/DRBrWy1nl+8fNyYtMtcBtbZvIf+kj4+ihBX4jLMhM5Ub4nOUpTj5OIXfQws40xTepRdMATFWmJp6gOIzyIhEFAlWMngRjsDyiJtrPg7A2QHDB0GG8nyufgCRctk9sp/2pNqP7LRN00wzfsuutJK9ertw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404024; 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=1rkZ2YwRMsyrYTYMEucwbbnhmMAQAJTgNbI7b1hhjkA=; b=aM7fHKnj90Gd7iqZ3k9JGaF7MWKyYx0wbjeTif6x8UAf9Menl63Uemj/TpkIVhUBvgJFssPHALZo6Ix8vDKtgoGxu8stmNFyGAomxy2AJ2KaeG+K/XcL0UAF4J2zIfBufMtGzHzKO9kWM1eVPd0g3R62Q3XHFGLsHuzTGqpZJ0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404024802171.0655988468692; Mon, 13 Dec 2021 06:00:24 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-603-tVEfq94XMpSJzhRzwAbMWQ-1; Mon, 13 Dec 2021 09:00:18 -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 6899781EE86; Mon, 13 Dec 2021 14:00:01 +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 396A122E00; Mon, 13 Dec 2021 14:00:01 +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 EE8D04BB7B; Mon, 13 Dec 2021 14:00:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxsK8002583 for ; Mon, 13 Dec 2021 08:59:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1750216A32; Mon, 13 Dec 2021 13:59:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 931BB22DFC for ; Mon, 13 Dec 2021 13:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404023; 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=1rkZ2YwRMsyrYTYMEucwbbnhmMAQAJTgNbI7b1hhjkA=; b=RaBzuSiYkcJfDmHdGl4mFgRb+sUb3i3wAAQcT9OMVBpQnOJH7qc5/BsIMcRteYsaKmgiUf CDvrq0NckkIBQjR6PW2FHRHoBoGIG1Jqaiqcceg5CiyDYFS5L2E4XhxD0tyvWaep7EZTMF jAhpvcZil1ujPuaiZS6xtb4mqpTQ4rc= X-MC-Unique: tVEfq94XMpSJzhRzwAbMWQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/14] lxc: use g_auto for virCommand in virLXCProcessEnsureRootFS Date: Mon, 13 Dec 2021 14:59:39 +0100 Message-Id: <9a9ce50970f9fc8761005fc8bfb661735589bbd7.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404032779100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/lxc/lxc_process.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 118d9cbdcc..db023630bd 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1187,7 +1187,7 @@ int virLXCProcessStart(virConnectPtr conn, char ebuf[1024]; g_autofree char *timestamp =3D NULL; int nsInheritFDs[VIR_LXC_DOMAIN_NAMESPACE_LAST]; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; virLXCDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virCaps) caps =3D NULL; virErrorPtr err =3D NULL; @@ -1555,7 +1555,6 @@ int virLXCProcessStart(virConnectPtr conn, virLXCProcessCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, st= opFlags); } } - virCommandFree(cmd); for (i =3D 0; i < nttyFDs; i++) VIR_FORCE_CLOSE(ttyFDs[i]); for (i =3D 0; i < G_N_ELEMENTS(handshakefds); i++) --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404047; cv=none; d=zohomail.com; s=zohoarc; b=Be47R/36Z2LTalwEP1m/kAuqK7tFl9fnNEjPW0lT3PBewjIyDRhmSy4CfDfVKaBCWbfeFkoT/o9Q1SAdxU0N+NVAyGEpHK4sPFfyh9yNjajHsswLSJ44M+O6WVzOu6aOtDVGxv2NlNCVQ8U93oa9OKxeF4QdyU2SPyIn5PmEVrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404047; 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=Klw9XPpWtMxUPohMIXg9MLP8lSxMheT7zICwXxdyf7o=; b=I8I1zFHVv0/gtOsAVAzT7E6W0zasnPfjr2sMQOoHxMPzAyKg/gnsUlCgLK/YuRpdW1CzgI3o1039/wWQVqrjf7F8gxpUy6rxCa/fEPFZaIBRlBMDGgv3TmEwexLkd9581pDT2bqc9dm6/k5uaH+/Cn9YNRSFzgg7ZLMIM5/QbJ8= 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) 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 1639404047745745.0792275374537; Mon, 13 Dec 2021 06:00:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-560-RDDJiLKfO3CYI-aTpUrgEA-1; Mon, 13 Dec 2021 09:00:38 -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 8CE56344E5; Mon, 13 Dec 2021 14:00:04 +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 62CEB22DFE; Mon, 13 Dec 2021 14:00:04 +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 1EC1B4A70A; Mon, 13 Dec 2021 14:00:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxsSn002595 for ; Mon, 13 Dec 2021 08:59:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id DF47316A31; Mon, 13 Dec 2021 13:59:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66C7F16A32 for ; Mon, 13 Dec 2021 13:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404046; 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=Klw9XPpWtMxUPohMIXg9MLP8lSxMheT7zICwXxdyf7o=; b=XTmwGyJv7mNYFuSSV6qA/cB1fJg7Zmf4cGWiCwH0b0YmPirCVxu6HWhYv9mcqrqG40SKQs OFRPV5Y2nVx+Gh8oa1CGJHqVpjZXxLgqy/n+aQgs6bDfJ1z0hle+sy+kh9fSQ2Skam5O3/ VilPg0WX6o0WPJmqQrco78p6tc5GBVg= X-MC-Unique: RDDJiLKfO3CYI-aTpUrgEA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/14] storage: logical: use two cmd vars in GetPoolSources Date: Mon, 13 Dec 2021 14:59:40 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404058811100002 Do not mix manual and automatic freeing. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/storage/storage_backend_logical.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_ba= ckend_logical.c index ed490b0201..3f27e63aeb 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -477,23 +477,23 @@ virStorageBackendLogicalGetPoolSources(virStoragePool= SourceList *sourceList) int vars[] =3D { 2 }; - g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virCommand) vgcmd =3D NULL; + g_autoptr(virCommand) pvcmd =3D NULL; =20 /* * NOTE: ignoring errors here; this is just to "touch" any logical vol= umes * that might be hanging around, so if this fails for some reason, the * worst that happens is that scanning doesn't pick everything up */ - cmd =3D virCommandNew(VGSCAN); - if (virCommandRun(cmd, NULL) < 0) + vgcmd =3D virCommandNew(VGSCAN); + if (virCommandRun(vgcmd, NULL) < 0) VIR_WARN("Failure when running vgscan to refresh physical volumes"= ); - virCommandFree(cmd); =20 - cmd =3D virCommandNewArgList(PVS, - "--noheadings", - "-o", "pv_name,vg_name", - NULL, NULL); - return virCommandRunRegex(cmd, 1, regexes, vars, + pvcmd =3D virCommandNewArgList(PVS, + "--noheadings", + "-o", "pv_name,vg_name", + NULL, NULL); + return virCommandRunRegex(pvcmd, 1, regexes, vars, virStorageBackendLogicalFindPoolSourcesFunc, sourceList, "pvs", NULL); } --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 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=1639404048; cv=none; d=zohomail.com; s=zohoarc; b=imaqOK8ki3Q7hal1aN5iBPoxxFW6T3Flpz8NpBAooAH3VYPQO2RHmnR427TMe3mUMXMgPzdRf9+wWRg/sT44AiukGubRDAtHcbl/LOQ2z9FCDsVYvj7Z5SJS27f+2U9RMzDyKp++QY2U0BHpAq12am/RtjsNQ47UypDCifIPmcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404048; 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=x8JjsdAIKBo/PqUHDrc+xQ9Ja8hwDVybhaJFH2Xm4Mk=; b=RmJHGfjNAsaKo1JXWi1bJIr9WYpH9ZVt/jPOJfjgr18xJAV33J1xLcADa8pBZrqkP6loJGBEFiZrFEsB0eF2/zw+Pz+5LdU5ZaTqYLeA6oNnpoAdX0Sa9lYa5FVm4Vc/zK+P4m5urfwOjSEaVa9A5MKly/oE0ZBIpK0d/B98roc= 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) 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 1639404048945403.64315324948825; Mon, 13 Dec 2021 06:00:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-400-NDZM7CclNqeZldTlYnZJ6w-1; Mon, 13 Dec 2021 09:00:42 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FFD2802E67; Mon, 13 Dec 2021 14:00:08 +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 3D11AADCB; Mon, 13 Dec 2021 14:00:08 +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 093591802E2C; Mon, 13 Dec 2021 14:00:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxtBh002602 for ; Mon, 13 Dec 2021 08:59:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id B455222DFC; Mon, 13 Dec 2021 13:59:55 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B0D416A31 for ; Mon, 13 Dec 2021 13:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404047; 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=x8JjsdAIKBo/PqUHDrc+xQ9Ja8hwDVybhaJFH2Xm4Mk=; b=SmI5twTuUFDGJaQjfaGKLpHDwU9IRKto4aJ329HZ735pu1jQOTbbGe5rvyIRQUsXz7vaUI bHZrH71aZR4zzRM5+1Hw+PRSjaHdlqKvaIxPJho9z3JTMYYJfhx4tBldKpErm/biZueKVV 7F4SJjk7y5fCa22fPV8KAH705mD97Yo= X-MC-Unique: NDZM7CclNqeZldTlYnZJ6w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 12/14] storage: util: steal cmd in CreateQemuImgCmdFromVol Date: Mon, 13 Dec 2021 14:59:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404059630100006 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/storage/storage_util.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index ce61f37172..bfc3edb1fd 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1116,7 +1116,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePo= olObj *pool, const char *inputSecretPath, virStorageVolEncryptConvertStep c= onvertStep) { - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; struct _virStorageBackendQemuImgInfo info =3D { .format =3D vol->target.format, .type =3D NULL, @@ -1246,11 +1246,10 @@ virStorageBackendCreateQemuImgCmdFromVol(virStorage= PoolObj *pool, } VIR_FREE(info.secretAlias); =20 - return cmd; + return g_steal_pointer(&cmd); =20 error: VIR_FREE(info.secretAlias); - virCommandFree(cmd); return NULL; } =20 --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404047; cv=none; d=zohomail.com; s=zohoarc; b=D1fnspoM8P+hnudfkCMxA0igHCAPh+S1eNMzF6bqO9Taqe5tNAg3m+V4ZJlBsQOPU6K2BfxpipV5yD1XEpwayHBJgdKjRM/Awp0HzspCh/lGlfEdyvjntr5jrPjIvuNBrbCXnpN4oyIR7sM6FyoZKezNqtng+F4KkaoSsjQ1eY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404047; 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=PN1Wi3pgZLZa6WINS6a66CuIaYPQGnWHLzcz4O5vHPE=; b=Q3RJbpUPXk0TiTUzxhXCuKRhiOtqXZcQBR0gRj/2SrdjeMM7HIetvQhzu8zon9Ra0DhmIECAy2SeUS5rCeVFojl1vD67ZWYqvM7/TtKU3PpL8jxHJyTEXHiC6zAhLlnDKydgPpXYGfBaMiDrHYKuVUWMkjDgxveOW9CaWMQFXfg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404047628980.2001426459109; Mon, 13 Dec 2021 06:00:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-TjUr4PAWNyC6ibSJaY3VQQ-1; Mon, 13 Dec 2021 09:00:28 -0500 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 74AE68464B8; Mon, 13 Dec 2021 14:00:08 +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 E76E778DA0; Mon, 13 Dec 2021 14:00:07 +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 94FCB4A70F; Mon, 13 Dec 2021 14:00:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxu6s002607 for ; Mon, 13 Dec 2021 08:59:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 86FE516A31; Mon, 13 Dec 2021 13:59:56 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EB8D22E07 for ; Mon, 13 Dec 2021 13:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404046; 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=PN1Wi3pgZLZa6WINS6a66CuIaYPQGnWHLzcz4O5vHPE=; b=FFv/VBFCDvyJl8F6wbT9GLy4GKPf/yoznrQFS7HrVpKHRibxef6bvJgaRih//fOQcAaaka Xd2A03BFZj+4DAXX1wU4Mijuh3pU1DRKGQLPpuPh1urEtSgM6EFJjk6gA6hHiZn6d6x/m8 OPP3pvQmE7VIOB0SVY+gjs4V4134ETA= X-MC-Unique: TjUr4PAWNyC6ibSJaY3VQQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/14] security: apparmor: use automatic cleanup in load_profile Date: Mon, 13 Dec 2021 14:59:42 +0100 Message-Id: <4d1298161e9c20d88e8d0834348cfd391e7a2d52.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404058734100001 Use g_auto for virCommand and char * and drop the cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/security/security_apparmor.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index dadcfd67db..d1087aa10c 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -163,14 +163,13 @@ load_profile(virSecurityManager *mgr G_GNUC_UNUSED, const char *fn, bool append) { - int rc =3D -1; bool create =3D true; - char *xml =3D NULL; - virCommand *cmd =3D NULL; + g_autofree char *xml =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; =20 xml =3D virDomainDefFormat(def, NULL, VIR_DOMAIN_DEF_FORMAT_SECURE); if (!xml) - goto cleanup; + return -1; =20 if (profile_status_file(profile) >=3D 0) create =3D false; @@ -191,13 +190,7 @@ load_profile(virSecurityManager *mgr G_GNUC_UNUSED, virLogGetDefaultPriority()); =20 virCommandSetInputBuffer(cmd, xml); - rc =3D virCommandRun(cmd, NULL); - - cleanup: - VIR_FREE(xml); - virCommandFree(cmd); - - return rc; + return virCommandRun(cmd, NULL); } =20 static int --=20 2.31.1 From nobody Thu May 2 23:16:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639404048; cv=none; d=zohomail.com; s=zohoarc; b=NkiL5iabucrXZLys6eekaiOuHt8Bd8WyTyqROXwH8TdwvzdQGLl3Yaa/lkoa89d8/IiX2mTIbAbKSVgnDqeKP62s9JmRW0sYrLnI1Y+hTn7HuBlAMNU9QDcbSv2QD2b1PLHhWtAF8/GvUJ+44wnnzBPk8FoUazOGA8yVNaX0WSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639404048; 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=gVJaE08Xt2qV0TuNB7ZbOX85MA4ZpxZugOEa7uqUpq0=; b=J1Lsc8rAgeNdy4IWWSD1rmdxgSq5rf7osOZFOGL4P47rnwmDkWrWeEmL2E88NolkNtwQGBYxM3cPQGiWyLT3LWmzMbU09dVwjYMrEc16QB5ImYVQJwJKgtP51Jg0wJL6NAszj19gVjS6pmdrIuQB2FbKlktPIcuoEIng6U8eQjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639404048543360.0561874415439; Mon, 13 Dec 2021 06:00:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-FT8OIjO6N3S6WtSohNf4yQ-1; Mon, 13 Dec 2021 09:00:39 -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 C707A10247C5; Mon, 13 Dec 2021 14:00:11 +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 719051F305; Mon, 13 Dec 2021 14:00:11 +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 3B5D31800654; Mon, 13 Dec 2021 14:00:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDDxvXI002615 for ; Mon, 13 Dec 2021 08:59:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5FF3F22E0F; Mon, 13 Dec 2021 13:59:57 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id D69D516A31 for ; Mon, 13 Dec 2021 13:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639404047; 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=gVJaE08Xt2qV0TuNB7ZbOX85MA4ZpxZugOEa7uqUpq0=; b=Qi9TS+HUsWEE7v772d6mB7X7LrgOivnJ33goZubXrcyXQ5QvEXOYWx8/TG4G70WMaY6q1l 2UUwgUTjQslSljLLdcKjrfqIYrgu+2d+z2bHwKR3qu7BBgEJgMhuYu4OHTGK5S+rPP17kw empNtJ9Ub9jnMZnEXF8mSKenfB8KkRU= X-MC-Unique: FT8OIjO6N3S6WtSohNf4yQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 14/14] qemu: use automatic cleanup for virCommand Date: Mon, 13 Dec 2021 14:59:43 +0100 Message-Id: <3f074213651a0f6bd12b698671a332538f773c46.1639403837.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639404059511100005 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 3 +-- src/qemu/qemu_interface.c | 3 +-- src/qemu/qemu_tpm.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e444ad2d45..db2b25adbd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6315,7 +6315,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, { virQEMUDriver *driver =3D conn->privateData; virDomainObj *vm =3D NULL; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; char *ret =3D NULL; size_t i; =20 @@ -6375,7 +6375,6 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, ret =3D virCommandToString(cmd, false); =20 cleanup: - virCommandFree(cmd); virObjectUnref(vm); return ret; } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index ac0168c80d..676bc896d6 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -320,7 +320,7 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *c= fg, int *tapfd, unsigned int flags) { - virCommand *cmd; + g_autoptr(virCommand) cmd =3D NULL; char *errbuf =3D NULL, *cmdstr =3D NULL; int pair[2] =3D { -1, -1 }; =20 @@ -387,7 +387,6 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *c= fg, cleanup: VIR_FREE(cmdstr); VIR_FREE(errbuf); - virCommandFree(cmd); VIR_FORCE_CLOSE(pair[0]); return *tapfd < 0 ? -1 : 0; } diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 1b923fd68e..7e7b01768e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -793,7 +793,7 @@ static void qemuTPMEmulatorStop(const char *swtpmStateDir, const char *shortName) { - virCommand *cmd; + g_autoptr(virCommand) cmd =3D NULL; g_autofree char *pathname =3D NULL; g_autofree char *errbuf =3D NULL; g_autofree char *swtpm_ioctl =3D virTPMGetSwtpmIoctl(); @@ -817,8 +817,6 @@ qemuTPMEmulatorStop(const char *swtpmStateDir, =20 ignore_value(virCommandRun(cmd, NULL)); =20 - virCommandFree(cmd); - /* clean up the socket */ unlink(pathname); } --=20 2.31.1