From nobody Sun Feb 8 18:19:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571576175; cv=none; d=zoho.com; s=zohoarc; b=bDbvjWdUCg6wJs0pvNaOAMzU9++vV5KVoDD+8qNfQjmh8oZoIRaj4sWRW5fRoEr2uLRJXT4DOFOg92os9Rs+9L8Zdj5iv9AHGcDnLiyn1lT3rMR9sKeBbou8hhUJ14s55uMFAsCIosDmAps0nCR47+ylIb5pWsyX2dRRRYTp6vQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571576175; 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=u0z+/zFnLUzH2lhTJSnYXEnZ1seVaz7fzSXp0FgdzjA=; b=PbtoiMBk1NZ5Dtcd4f5Ivsf36p6dGG+isRuMRB3fAgkwWL6CXVF2BYAAs5WRkFoKHD43wpEUxSc27sVyIAkhVpuF/lIlzriT+EM0Cy+00h+kXkzUFBR8vqNz3Y8GDUboE1cFLLWUXYCxe1BnDNhp33NAZGyOXQT78D9H9BEktH4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571576175460363.72102285912797; Sun, 20 Oct 2019 05:56:15 -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-382-HboyD2x3OmehqTqDaInIYg-1; Sun, 20 Oct 2019 08:56:12 -0400 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 BFD011005509; Sun, 20 Oct 2019 12:56: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 977095D6A3; Sun, 20 Oct 2019 12:56: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 5E30E4EDA5; Sun, 20 Oct 2019 12:56: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 x9KCtYmu023324 for ; Sun, 20 Oct 2019 08:55:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92D4C196AE; Sun, 20 Oct 2019 12:55:34 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-23.brq.redhat.com [10.40.200.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE74A1EC for ; Sun, 20 Oct 2019 12:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571576174; 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=u0z+/zFnLUzH2lhTJSnYXEnZ1seVaz7fzSXp0FgdzjA=; b=b3gqoqLIKR2rJh0IcMO8QCFN5fCmJMNPXUHV3n0FoUksEO50bX2ynXP7XBw7MkZN/ZZwWH l88wtEf7oEgqTpxj5Q8p0VvvssXDyeKtt9gH9nAPI/WfkQr521y278mIoJgA+jGzx88HvK s/tImlT0fzCjadqYglXiHlrdheHJ9dg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sun, 20 Oct 2019 14:55:21 +0200 Message-Id: <149311d38a9e454ba69e02dd58b62f9e82c84ba1.1571575889.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 Subject: [libvirt] [PATCH 03/34] conf: use g_strdup in virDomainDiskSet 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 X-MC-Unique: HboyD2x3OmehqTqDaInIYg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use a temporary variable to allow copying from the currently set source. Always return 0 since none of the callers distinguishes between 0 and 1 propagated from VIR_STRDUP. Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 88e93f6fb8..cd9b6ca993 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2139,15 +2139,10 @@ virDomainDiskGetSource(virDomainDiskDef const *def) int virDomainDiskSetSource(virDomainDiskDefPtr def, const char *src) { - int ret; - char *tmp =3D def->src->path; - - ret =3D VIR_STRDUP(def->src->path, src); - if (ret < 0) - def->src->path =3D tmp; - else - VIR_FREE(tmp); - return ret; + char *tmp =3D g_strdup(src); + g_free(def->src->path); + def->src->path =3D tmp; + return 0; } =20 =20 @@ -2174,15 +2169,10 @@ virDomainDiskGetDriver(const virDomainDiskDef *def) int virDomainDiskSetDriver(virDomainDiskDefPtr def, const char *name) { - int ret; - char *tmp =3D def->driverName; - - ret =3D VIR_STRDUP(def->driverName, name); - if (ret < 0) - def->driverName =3D tmp; - else - VIR_FREE(tmp); - return ret; + char *tmp =3D g_strdup(name); + g_free(def->driverName); + def->driverName =3D tmp; + return 0; } =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list