From nobody Mon Feb 9 10:57:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1598271125; cv=none; d=zohomail.com; s=zohoarc; b=GT3u2sBXRKaDwmlDTRY+QcfwaM3PUYtUHGAFycqQpCr49+ZUALl/XWiPBqJk859GzVT5l7w5GMSHyzIfMouN/04CBu16LAWX4VcCq48ewL6Q1SmjHuisU3g1h5wDcfAxUKuqO7n5Wg2K03U6bNyHTUzErnkhuo3OJC8PdgDSNw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598271125; 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=rRSoNID+1yeZIJmYnvP2uVq/Npv5fW0Z4QiZVezR4l8=; b=NJkokpPdkH6IragwM4BJLpFU0bDlh6lwWUj3WurARwRFa1BhnrSU0l+XJMu1iYe1pEp/DhbsTAgF+zBaxMJDOQfryqa3hc9uxs8AgSp+dUGaEbBSq0rE9mOZY6tQF1lE6WiT+fG0/RuWtvwQ48qO7Wj7sdIUz+9FhkX9rJ5qLnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1598271125139514.8655937811321; Mon, 24 Aug 2020 05:12:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-t9H3a4JZMCW0oYHuxXHXsw-1; Mon, 24 Aug 2020 08:11:11 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F0482801AF9; Mon, 24 Aug 2020 12:11:03 +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 CC09F1001B2B; Mon, 24 Aug 2020 12:11: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 942ED18A0B66; Mon, 24 Aug 2020 12:11:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07OC654d030794 for ; Mon, 24 Aug 2020 08:06:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14B1510013C1; Mon, 24 Aug 2020 12:06:05 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B59F10013D9 for ; Mon, 24 Aug 2020 12:06:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598271123; 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=rRSoNID+1yeZIJmYnvP2uVq/Npv5fW0Z4QiZVezR4l8=; b=RhHncjg5BwCYckrJJxPOEVOn8mV6aR/wJSSOjcXkC5Y0uQKTaDz6fO9fDhQzcmZff5AS1c bhIJNSOqGPt87kHQuRd1xz6p0CwBTDboINzaK7lAW6FSqH09qnJWQca/VoAbspKTx9Kdre +gGoXwWN93eepYI8TO8MMcCHDFAmOI8= X-MC-Unique: t9H3a4JZMCW0oYHuxXHXsw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/7] qemuMigrationParamsNew: Use new memory allocation to simplify code Date: Mon, 24 Aug 2020 14:05:53 +0200 Message-Id: <23e69dae1089851f21e6e58fb139d182fb07fc78.1598270694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use automatic memory cleaning and allocate via g_new0. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_migration_params.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 04434e9557..f466c3c4f6 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -244,20 +244,14 @@ qemuMigrationParamsGetAlwaysOnCaps(qemuMigrationParty= party) qemuMigrationParamsPtr qemuMigrationParamsNew(void) { - qemuMigrationParamsPtr params; + g_autoptr(qemuMigrationParams) params =3D NULL; - if (VIR_ALLOC(params) < 0) - return NULL; - - params->caps =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST); - if (!params->caps) - goto error; + params =3D g_new0(qemuMigrationParams, 1); - return params; + if (!(params->caps =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST))) + return NULL; - error: - qemuMigrationParamsFree(params); - return NULL; + return g_steal_pointer(¶ms); } --=20 2.26.2