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/
Home Products Support Community News


[Xen-devel] [PATCH] xenstore: Fix memory leak in command 'xenstore rm'

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xenstore: Fix memory leak in command 'xenstore rm'
From: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Date: Fri, 18 Dec 2009 17:28:49 +0800
Delivery-date: Fri, 18 Dec 2009 01:28:47 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 3.0a1 (Windows/2008050715)
When option '-t' is used to do tidy remove, routine xs_directory()
will be called in order to check there are brother directories or not.
The returned pointer should be passed to free() after this check.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>

diff -r 1a911fd65e52 -r 1bd6c2c5e109 tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c  Fri Dec 18 07:53:27 2009 +0000
+++ b/tools/xenstore/xenstore_client.c  Fri Dec 11 23:38:23 2009 +0800
@@ -343,8 +343,10 @@
                         unsigned int num;
                         char ** list = xs_directory(xsh, xth, p, &num);
-                        if (list && num == 0) {
-                            goto again;
+                        if (list) {
+                            free(list);
+                            if (num == 0)
+                                goto again;

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xenstore: Fix memory leak in command 'xenstore rm', Yu Zhiguo <=