From: Eric Sandeen Date: Mon, 15 Sep 2014 23:19:08 +0000 (+1000) Subject: libhandle: Fix handle leak in path_to_fshandle error paths X-Git-Tag: v3.2.2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f1c8e13fc8db6e7879a8372e33b8720d4de7b9e;p=thirdparty%2Fxfsprogs-dev.git libhandle: Fix handle leak in path_to_fshandle error paths path_to_fshandle calls obj_to_handle, which potentially allocates a handle, but the handle isn't freed on a subsequent error path. Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/libhandle/handle.c b/libhandle/handle.c index 9f81483b5..3c1395a64 100644 --- a/libhandle/handle.c +++ b/libhandle/handle.c @@ -97,6 +97,7 @@ path_to_fshandle( /* new filesystem. add it to the cache */ fdhp = malloc(sizeof(struct fdhash)); if (fdhp == NULL) { + free(*fshanp); close(fd); errno = ENOMEM; return -1;