aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-21 10:39:48 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-21 10:39:48 +0000
commit80031349d5d6c9eda98781bdc7346739bdca8143 (patch)
treecd3e8f60b360ce0f1475f963ab8dc479d1fb23f7 /tools/xenstore
parent344e13af46cdb531897899ac40708d431af0a1af (diff)
downloadxen-80031349d5d6c9eda98781bdc7346739bdca8143.tar.gz
xen-80031349d5d6c9eda98781bdc7346739bdca8143.tar.bz2
xen-80031349d5d6c9eda98781bdc7346739bdca8143.zip
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@cn.fujitsu.com>
Diffstat (limited to 'tools/xenstore')
-rw-r--r--tools/xenstore/xenstore_client.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index aaf3014d53..50fc3d7646 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -343,8 +343,10 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
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;
}
}
}