xenstore: Fix memory leak in command 'xenstore rm'
PATCH 1/1 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 <[email protected]>
tools/xenstore/xenstore_client.c +4 -2
@@ -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; } } }