xfs
[Top] [All Lists]

[PATCH 1/4] xfsprogs: Free all data in libxfs_umount; call from xfs_copy

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH 1/4] xfsprogs: Free all data in libxfs_umount; call from xfs_copy as well
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 20 Aug 2015 13:08:27 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <55D61740.9070507@xxxxxxxxxxx>
References: <55D61740.9070507@xxxxxxxxxxx>
libxfs_umount was failing to free a handful of resources; fix that up.
Call it from xfs_copy as well, while we're at it; every other libxfs_mount
has a libxfs_umount counterpart, at least on a clean exit.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
 copy/xfs_copy.c |    2 ++
 libxfs/init.c   |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index e13f468..4497b7f 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -1165,6 +1165,8 @@ main(int argc, char **argv)
        }
 
        check_errors();
+       libxfs_umount(mp);
+
        return 0;
 }
 
diff --git a/libxfs/init.c b/libxfs/init.c
index 2859f94..c7f9dc8 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -832,6 +832,15 @@ libxfs_umount(xfs_mount_t *mp)
                pag = radix_tree_delete(&mp->m_perag_tree, agno);
                kmem_free(pag);
        }
+
+       kmem_free(mp->m_attr_geo);
+       kmem_free(mp->m_dir_geo);
+
+       kmem_free(mp->m_rtdev_targp);
+       if (mp->m_logdev_targp != mp->m_ddev_targp)
+               kmem_free(mp->m_logdev_targp);
+       kmem_free(mp->m_ddev_targp);
+       
 }
 
 /*
-- 1.7.1


<Prev in Thread] Current Thread [Next in Thread>