From nobody Wed Nov 5 11:52:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498188159903124.96626284635033; Thu, 22 Jun 2017 20:22:39 -0700 (PDT) Received: from localhost ([::1]:33412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOFB7-0005jN-Qh for importer@patchew.org; Thu, 22 Jun 2017 23:22:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOFAE-00058w-T1 for qemu-devel@nongnu.org; Thu, 22 Jun 2017 23:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOFAA-0004y5-5m for qemu-devel@nongnu.org; Thu, 22 Jun 2017 23:21:42 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:39172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOFA9-0004jO-JF for qemu-devel@nongnu.org; Thu, 22 Jun 2017 23:21:38 -0400 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 23 Jun 2017 03:13:57 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v5N3IPoH079683; Fri, 23 Jun 2017 11:18:25 +0800 (GMT-8) (envelope-from li.ping288@zte.com.cn) Received: from localhost.localdomain ([10.74.120.79]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017062311183030-2120679 ; Fri, 23 Jun 2017 11:18:30 +0800 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170623111357 From: Li Ping To: mdroth@linux.vnet.ibm.com Date: Fri, 23 Jun 2017 11:17:43 +0800 Message-Id: <1498187863-4937-1-git-send-email-li.ping288@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-06-23 11:18:30, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-06-23 11:18:10 Content-Transfer-Encoding: quoted-printable X-MAIL: mse01.zte.com.cn v5N3IPoH079683 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH RESEND] QEMU Guest Agent: Fix memory leak of device information set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Li Ping Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The caller of SetupDiGetClassDevs must delete the returned device informati= on set when it is no longer needed by calling SetupDiDestroyDeviceInfoList. Signed-off-by: Li Ping Reviewed-by: Marc-Andr=C3=A9 Lureau --- qga/commands-win32.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 439d229..6f16457 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -512,7 +512,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) } else { error_setg_win32(errp, GetLastError(), "failed to get device name"); - goto out; + goto free_dev_info; } } =20 @@ -560,6 +560,9 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) pci->bus =3D bus; break; } + +free_dev_info: + SetupDiDestroyDeviceInfoList(dev_info); out: g_free(buffer); g_free(name); --=20 1.8.3.1