From nobody Wed Apr 24 00:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1602767090; cv=none; d=zohomail.com; s=zohoarc; b=k22K+CjyyADGOQyEvVeIReMais2Fq0WnXnrwOBe8/OG52WA0LMkc1RvjmTN5pTgz0weJIxGf4o7+fuLgppgABg+Qb3peOnOFZTHJIMOGoqqhWU2fvauBpYshsowL/kttoH/6g4vcgyhGM8a6dIkoAvCANh8IMrboi32PC9gQR4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602767090; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=1X4pJaioWVPMO98qAZiSfmARICUXJYIAmu1r2ZmHK2A=; b=brfxgN2xwXvsri1WfLQ6tTMppHIw6HszJf7ByEVg5yxRt3b+vajdwmJSKyD+z6icSAVlW5bsmtbH7SSovbA/r449HLfVInjqWYCCBnFxJ/IodwfFJJsGeN9P+B5xj4TxpJlP69/q63jt4k5DU/Xk5tJcWQInLrP+8MSO4t4qiso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1602767090304642.0064441362399; Thu, 15 Oct 2020 06:04:50 -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-475-O1arGHQHO0O3QfzAPMorCA-1; Thu, 15 Oct 2020 09:01:39 -0400 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 2B55A108E1A3; Thu, 15 Oct 2020 13:01:33 +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 0A6906EF7D; Thu, 15 Oct 2020 13:01:33 +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 C3C905810D; Thu, 15 Oct 2020 13:01:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09FD0sgB024309 for ; Thu, 15 Oct 2020 09:00:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5BEF760E1C; Thu, 15 Oct 2020 13:00:54 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id D86D260C07 for ; Thu, 15 Oct 2020 13:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602766903; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1X4pJaioWVPMO98qAZiSfmARICUXJYIAmu1r2ZmHK2A=; b=WhkEe7P8Wu/C8qoZ5HzsG0eg48t4sxHDhijdb8i+kb+w1hDug/3dPrG3MDisGWxLORF5wE wf+s1U4+oc9LAmy/OU+52hEIvb07qlvSs2cyRwkB/R8RU6jMRhKII4Jdo8RGNTOCslFOkv WSXtscez+MQASE4QABRujt6Q9jrdMfU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602767089; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1X4pJaioWVPMO98qAZiSfmARICUXJYIAmu1r2ZmHK2A=; b=AkdaoleqSls/EKm98nb29oHNiHkx2biebVZdtb3mYU7LoGn8BxWTUbV0bBUt/Sk3pkD+ib o3I1j8IyCNzaTI4ead+NHr8MlCq2xGcKvhQneb5l5Nw02uDMzYl3O4PkE7Bhp4Y825ioZL twj+2ub1GkHBkYsVu94qIu+hOQ3ZPwg= X-MC-Unique: O1arGHQHO0O3QfzAPMorCA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: agent: fix array access Date: Thu, 15 Oct 2020 15:00:49 +0200 Message-Id: <107cbef93c2d431dad3da84d065dcbd7a8462445.1602766847.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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) (identity @redhat.com) My code movement changed the type of ifaces_ret from virDomainInterfacePtr * to virDomainInterfacePtr **, but failed to adjust the condition or dereference the array correctly. Signed-off-by: J=C3=A1n Tomko Fixes: 6ddb1f803ea38d8d709b984fa9539e34318a9dc0 Reviewed-by: Michal Privoznik --- src/qemu/qemu_agent.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index c9c4b034d3..4c61c5cdc6 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -2209,6 +2209,7 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfaceP= tr **ifaces_ret, size_t ifaces_count =3D 0; size_t i; =20 + *ifaces_ret =3D NULL; /* Hash table to handle the interface alias */ ifaces_store =3D virHashNew(NULL); =20 @@ -2223,9 +2224,9 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfaceP= tr **ifaces_ret, return ifaces_count; =20 error: - if (ifaces_ret) { + if (*ifaces_ret) { for (i =3D 0; i < ifaces_count; i++) - virDomainInterfaceFree(*ifaces_ret[i]); + virDomainInterfaceFree((*ifaces_ret)[i]); } VIR_FREE(*ifaces_ret); return -1; --=20 2.26.2