From patchwork Wed Jan 20 19:01:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 8073651 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F36749F818 for ; Wed, 20 Jan 2016 19:04:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56D6320504 for ; Wed, 20 Jan 2016 19:04:15 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A67A204FC for ; Wed, 20 Jan 2016 19:04:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLy0q-0001MR-U3; Wed, 20 Jan 2016 19:01:48 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLy0o-0001M3-RD for xen-devel@lists.xen.org; Wed, 20 Jan 2016 19:01:46 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 82/5E-31122-A99DF965; Wed, 20 Jan 2016 19:01:46 +0000 X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1453316504!11185342!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29013 invoked from network); 20 Jan 2016 19:01:45 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-15.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jan 2016 19:01:45 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u0KJ1hAg009080 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 20 Jan 2016 19:01:44 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u0KJ1hT6014962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 20 Jan 2016 19:01:43 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.13.8) with ESMTP id u0KJ1hTi002672; Wed, 20 Jan 2016 19:01:43 GMT Received: from localhost.localdomain (/87.196.251.223) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Jan 2016 11:01:43 -0800 From: Joao Martins To: libvir-list@redhat.com, jfehlig@suse.com Date: Wed, 20 Jan 2016 19:01:46 +0000 Message-Id: <1453316506-30502-1-git-send-email-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.1.4 X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Joao Martins , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH] libxl: dispose libxl_dominfo after libxl_domain_info() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As suggested in a previous thread [0] this patch adds some missing calls to libxl_dominfo_dispose when doing some of the libxl_domain_info operations which would otherwise lead to memory leaks. [0] https://www.redhat.com/archives/libvir-list/2015-September/msg00519.html Signed-off-by: Joao Martins --- src/libxl/libxl_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 73ed448..a449730 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -358,6 +358,8 @@ libxlReconnectDomain(virDomainObjPtr vm, virObjectLock(vm); + libxl_dominfo_init(&d_info); + /* Does domain still exist? */ rc = libxl_domain_info(cfg->ctx, &d_info, vm->def->id); if (rc == ERROR_INVAL) { @@ -389,11 +391,13 @@ libxlReconnectDomain(virDomainObjPtr vm, /* Enable domain death events */ libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW); + libxl_dominfo_dispose(&d_info); virObjectUnlock(vm); virObjectUnref(cfg); return 0; out: + libxl_dominfo_dispose(&d_info); libxlDomainCleanup(driver, vm); if (!vm->persistent) virDomainObjListRemoveLocked(driver->domains, vm); @@ -1598,6 +1602,8 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) info->cpuTime = d_info.cpu_time; info->memory = d_info.current_memkb; info->maxMem = d_info.max_memkb; + + libxl_dominfo_dispose(&d_info); } info->state = virDomainObjGetState(vm, NULL);