]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_healer: don't leak wh->mntpoint if fd_to_handle fails
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 Jun 2026 04:59:37 +0000 (21:59 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 3 Jun 2026 08:45:24 +0000 (10:45 +0200)
Codex noticed that we leak wh->mntpoint if fd_to_handle fails, so fix
that leak.

Cc: linux-xfs@vger.kernel.org # v7.0.0
Fixes: 6f0f35a87c8797 ("xfs_healer: enable repairing filesystems")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
healer/weakhandle.c

index 506689aa77637ef8eb40d2a89bb8f675a5f2a6e9..6c0dbb301c4f7d1dea56a929947e6bd68fdd5a44 100644 (file)
@@ -63,11 +63,13 @@ weakhandle_alloc(
 
        ret = fd_to_handle(fd, &wh->hanp, &wh->hlen);
        if (ret)
-               goto out_wh;
+               goto out_mntpt;
 
        *whp = wh;
        return 0;
 
+out_mntpt:
+       free(wh->mntpoint);
 out_wh:
        free(wh);
        return -1;