From 70ac12f8025e28c99b0884ace402e0802aa4d0b5 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Tue, 16 Sep 2014 09:19:24 +1000 Subject: [PATCH] xfs_io: fix leaks in parent_list() parent_list() has instances where a handle is leaked, both by going out of scope, and on error paths. Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- io/parent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/io/parent.c b/io/parent.c index 56e126d32..0313119fa 100644 --- a/io/parent.c +++ b/io/parent.c @@ -293,7 +293,7 @@ print_parent_entry(parent_t *parent, int fullpath) static int parent_list(int fullpath) { - void *handlep; + void *handlep = NULL; size_t handlen; int error, i; int retval = 1; @@ -313,6 +313,7 @@ parent_list(int fullpath) progname, path, strerror(errno)); goto error; } + free_handle(fshandle, fshlen); } if (path_to_handle(path, &handlep, &handlen) != 0) { @@ -325,7 +326,7 @@ parent_list(int fullpath) if (!parentbuf) { fprintf(stderr, _("%s: unable to allocate parent buffer: %s\n"), progname, strerror(errno)); - return 1; + goto error; } if (fullpath) { @@ -365,6 +366,7 @@ parent_list(int fullpath) retval = 0; error: + free(handlep); free(parentbuf); return retval; } -- 2.47.2