WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xl daemon: fix some memory leaks

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl daemon: fix some memory leaks
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 18 Feb 2011 01:50:14 -0800
Delivery-date: Fri, 18 Feb 2011 01:50:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1297969965 0
# Node ID 2ad66067784da47eef7ce2d0a204fbeae0557ef1
# Parent  30baafb3250ac6c6d55192f601c4e2946edd803d
xl daemon: fix some memory leaks

If we are watching multiple disks we have to free multiple waiters.

Free the event before continuing the loop.

Destroy the disk device returned by libxl_event_get_disk_eject_info.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff -r 30baafb3250a -r 2ad66067784d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Feb 17 12:18:01 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Feb 17 19:12:45 2011 +0000
@@ -1334,7 +1334,7 @@ static int create_domain(struct domain_c
     const char *restore_file = dom_info->restore_file;
     int migrate_fd = dom_info->migrate_fd;
 
-    int fd;
+    int fd, i;
     int need_daemon = 1;
     int ret, rc;
     libxl_waiter *w1 = NULL, *w2 = NULL;
@@ -1603,7 +1603,10 @@ start:
             case LIBXL_EVENT_DOMAIN_DEATH:
                 ret = libxl_event_get_domain_death_info(&ctx, domid, &event, 
&info);
 
-                if (ret < 0) continue;
+                if (ret < 0) {
+                    libxl_free_event(&event);
+                    continue;
+                }
 
                 LOG("Domain %d is dead", domid);
 
@@ -1619,7 +1622,8 @@ start:
                         /* Otherwise fall through and restart. */
                     case 1:
 
-                        libxl_free_waiter(w1);
+                        for (i = 0; i < d_config.num_disks; i++)
+                            libxl_free_waiter(&w1[i]);
                         libxl_free_waiter(w2);
                         free(w1);
                         free(w2);
@@ -1655,8 +1659,10 @@ start:
                 }
                 break;
             case LIBXL_EVENT_DISK_EJECT:
-                if (libxl_event_get_disk_eject_info(&ctx, domid, &event, 
&disk))
+                if (libxl_event_get_disk_eject_info(&ctx, domid, &event, 
&disk)) {
                     libxl_cdrom_insert(&ctx, domid, &disk);
+                    libxl_device_disk_destroy(&disk);
+                }
                 break;
         }
         libxl_free_event(&event);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl daemon: fix some memory leaks, Xen patchbot-unstable <=