From nobody Sun Feb 8 12:20:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1601850173; cv=none; d=zohomail.com; s=zohoarc; b=RQsSdFD/akDvTwhvmGESKSwaG3DmHCgdHOIh0963hXAm/WdGzw3xU5UQsykA98NzzNFYcUsaCnHsk1BPXBFlJECynS3Oj8TvOIKlHmP5YZ3yXOGh1tWmKCSQUROVCgKSBOoMSOBuDYnLdQf3qnVTa7vn/uX6rL9qbbuwbWwLGV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601850173; 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=1KP2y6kl3uvXvyXSC0W1WscZH8nCjo54gLw1bCFY9s8=; b=nZYnbJeEf5bvG5F/VgBOxtvTvvy1Fntb6I39xFyZFLr1Qg3h0l+8OKS1YPsk4GScVQGJE6T0ja+D7O/pUweWgBwDB8ZuJZ2zIwts0FnV5SWXFz/tal+RLx3ui5RnW5SyIe7Qq0fywvqzbQbzee800VHNaOC8zKTVXEHLkJO6iC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601850173747454.38681830317773; Sun, 4 Oct 2020 15:22:53 -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-502-Fv6JxkXKNpSmw5tkegPjkg-1; Sun, 04 Oct 2020 18:22:50 -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 ECB9610054FF; Sun, 4 Oct 2020 22:22:44 +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 C9BDD55783; Sun, 4 Oct 2020 22:22:44 +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 9A21E181A2E5; Sun, 4 Oct 2020 22:22:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 094MMhha031587 for ; Sun, 4 Oct 2020 18:22:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6049055789; Sun, 4 Oct 2020 22:22:43 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC1F955783 for ; Sun, 4 Oct 2020 22:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601850172; 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=1KP2y6kl3uvXvyXSC0W1WscZH8nCjo54gLw1bCFY9s8=; b=CGyCWDzNB4bStvtm3PZcPOA6VAsOhA+ZHt5KwddOq61C+s+k9Mi5kpapEHNJ7JxcokKZfU sAses+UuOKhQvQ+xCRQFje5WjssYove5AvBhWEjlLnEMhJs23F0j0HVXoROE4/YUJy3soU C/uRMVqRU4bpJxKqNzl34GrJA3VH+oI= X-MC-Unique: Fv6JxkXKNpSmw5tkegPjkg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] vbox: use g_new0 in vboxDumpAudio Date: Mon, 5 Oct 2020 00:22:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.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) Elimination of the positive conditions reduces the indentation by two levels. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- src/vbox/vbox_common.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 9f6ef2f2ac..45fd670a11 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3798,20 +3798,16 @@ vboxDumpAudio(virDomainDefPtr def, vboxDriverPtr da= ta G_GNUC_UNUSED, PRUint32 audioController =3D AudioControllerType_AC97; =20 def->nsounds =3D 1; - if (VIR_ALLOC_N(def->sounds, def->nsounds) >=3D 0) { - if (VIR_ALLOC(def->sounds[0]) >=3D 0) { - gVBoxAPI.UIAudioAdapter.GetAudioController(audioAdapte= r, &audioController); - if (audioController =3D=3D AudioControllerType_SB16) { - def->sounds[0]->model =3D VIR_DOMAIN_SOUND_MODEL_S= B16; - } else if (audioController =3D=3D AudioControllerType_= AC97) { - def->sounds[0]->model =3D VIR_DOMAIN_SOUND_MODEL_A= C97; - } - } else { - VIR_FREE(def->sounds); - def->nsounds =3D 0; - } - } else { - def->nsounds =3D 0; + if (VIR_ALLOC_N(def->sounds, def->nsounds) < 0) + return; + if (VIR_ALLOC(def->sounds[0]) < 0) + return; + + gVBoxAPI.UIAudioAdapter.GetAudioController(audioAdapter, &audi= oController); + if (audioController =3D=3D AudioControllerType_SB16) { + def->sounds[0]->model =3D VIR_DOMAIN_SOUND_MODEL_SB16; + } else if (audioController =3D=3D AudioControllerType_AC97) { + def->sounds[0]->model =3D VIR_DOMAIN_SOUND_MODEL_AC97; } } VBOX_RELEASE(audioAdapter); --=20 2.26.2