]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: fix open_by_handle memory leak
authorBill Kendall <wkendall@sgi.com>
Fri, 6 May 2011 16:42:57 +0000 (16:42 +0000)
committerAlex Elder <aelder@sgi.com>
Thu, 19 May 2011 16:23:20 +0000 (11:23 -0500)
open_by_handle() calls handle_to_fshandle() which
allocates an fshandle on the heap, which is never
freed by open_by_handle(). There is no need to
call handle_to_fshandle() though, just pass the
fhandle (rather than fshandle) to handle_to_fsfd(),
like the other *_by_handle() functions do.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
libhandle/handle.c

index c3a61299c1739a9ba26167086ef975a51d5541cc..b1ec5f2a7c7d9b17bdd94d2a3620c4d2e0395045 100644 (file)
@@ -292,14 +292,9 @@ open_by_handle(
 {
        int             fsfd;
        char            *path;
-       void            *fshanp;
-       size_t          fshlen;
        xfs_fsop_handlereq_t hreq;
 
-       if (handle_to_fshandle(hanp, hlen, &fshanp, &fshlen) != 0)
-               return -1;
-
-       if ((fsfd = handle_to_fsfd(fshanp, &path)) < 0)
+       if ((fsfd = handle_to_fsfd(hanp, &path)) < 0)
                return -1;
 
        hreq.fd       = 0;