public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Garlick <garlick@llnl.gov>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] libext2fs memory leak in ext2fs_write_new_inode()
Date: Wed, 4 Apr 2007 17:21:05 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0704041717470.1374@webb> (raw)

The following patch addresses a memory leak in libext2fs
that occurs when using ext2fs_write_new_inode() on a file system
configured with large inodes.

Signed-off-by: Jim Garlick <garlick@llnl.gov>

Index: e2fsprogs+chaos/lib/ext2fs/inode.c
===================================================================
--- e2fsprogs+chaos.orig/lib/ext2fs/inode.c
+++ e2fsprogs+chaos/lib/ext2fs/inode.c
@@ -752,6 +752,7 @@ errcode_t ext2fs_write_new_inode(ext2_fi
  	struct ext2_inode	*buf;
  	int 			size = EXT2_INODE_SIZE(fs->super);
  	struct ext2_inode_large	*large_inode;
+	errcode_t		rc;

  	if (size == sizeof(struct ext2_inode))
  		return ext2fs_write_inode_full(fs, ino, inode,
@@ -768,7 +769,9 @@ errcode_t ext2fs_write_new_inode(ext2_fi
  	large_inode->i_extra_isize = sizeof(struct ext2_inode_large) -
  		EXT2_GOOD_OLD_INODE_SIZE;

-	return ext2fs_write_inode_full(fs, ino, buf, size);
+	rc = ext2fs_write_inode_full(fs, ino, buf, size);
+	free(buf);
+	return rc;
  }

             reply	other threads:[~2007-04-05  0:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05  0:21 Jim Garlick [this message]
2007-04-06 12:53 ` [PATCH] libext2fs memory leak in ext2fs_write_new_inode() Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0704041717470.1374@webb \
    --to=garlick@llnl.gov \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox