]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
debugfs: don't leak mmp_s memory (on error path)
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 12 Dec 2013 17:52:00 +0000 (12:52 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 Dec 2013 17:57:27 +0000 (12:57 -0500)
ext2fs_free_mem() takes a pointer to a pointer, similar to
ext2fs_get_mem().  Improve the documentation, and fix debugfs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/set_fields.c
lib/ext2fs/ext2fs.h

index b09e2f89feccf5c1edc3f650270377845b8276ec..064de395d4f60ba38c690f3d1a29e6ca71d7cb95 100644 (file)
@@ -802,7 +802,7 @@ void do_set_mmp_value(int argc, char *argv[])
                if (retval) {
                        com_err(argv[0], retval, "reading MMP block %llu.\n",
                                (long long)current_fs->super->s_mmp_block);
-                       ext2fs_free_mem(mmp_s);
+                       ext2fs_free_mem(&mmp_s);
                        return;
                }
                current_fs->mmp_buf = mmp_s;
index 9f62cbbe6accb03b36c6cc09b60bfe5232b3df96..c982327ec2a79e5cb6be4d7c619fe07f59aa05e8 100644 (file)
@@ -1517,7 +1517,7 @@ extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
 #ifndef EXT2_CUSTOM_MEMORY_ROUTINES
 #include <string.h>
 /*
- *  Allocate memory
+ *  Allocate memory.  The 'ptr' arg must point to a pointer.
  */
 _INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
 {
@@ -1564,7 +1564,7 @@ _INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count,
 }
 
 /*
- * Free memory
+ * Free memory.  The 'ptr' arg must point to a pointer.
  */
 _INLINE_ errcode_t ext2fs_free_mem(void *ptr)
 {
@@ -1578,7 +1578,7 @@ _INLINE_ errcode_t ext2fs_free_mem(void *ptr)
 }
 
 /*
- *  Resize memory
+ *  Resize memory.  The 'ptr' arg must point to a pointer.
  */
 _INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
                                     unsigned long size, void *ptr)