]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libhandle: Fix handle leak in path_to_fshandle error paths
authorEric Sandeen <sandeen@redhat.com>
Mon, 15 Sep 2014 23:19:08 +0000 (09:19 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 15 Sep 2014 23:19:08 +0000 (09:19 +1000)
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 <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libhandle/handle.c

index 9f81483b5a355693b9d73bb6658e0b7794c20d3e..3c1395a64417810f44b61809a0d113e56d660e76 100644 (file)
@@ -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;