[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.