From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: a.sahrawat@samsung.com, xfs@oss.sgi.com,
Vivek Trivedi <t.vivek@samsung.com>,
pankaj.m@samsung.com
Subject: Re: [PATCH v2 1/4] xfsprogs: xfs_io: fix a memory leak in imap_f
Date: Mon, 21 Dec 2015 10:48:30 +1100 [thread overview]
Message-ID: <20151220234830.GV26718@dastard> (raw)
In-Reply-To: <20151220153357.GC20135@infradead.org>
On Sun, Dec 20, 2015 at 07:33:57AM -0800, Christoph Hellwig wrote:
> > @@ -39,6 +39,8 @@ imap_f(int argc, char **argv)
> > - if (count == 0)
> > + if (count == 0) {
> > + free(t);
> > return 0;
> > + }
>
> please use a goto out_free; here
>
> >
> > for (i = 0; i < count; i++) {
> > printf(_("ino %10llu count %2d mask %016llx\n"),
> > (unsigned long long)t[i].xi_startino,
> > @@ -55,6 +59,7 @@ imap_f(int argc, char **argv)
> > (unsigned long long)t[i].xi_allocmask);
> > }
> > }
> > + free(t);
> > perror("xfsctl(XFS_IOC_FSINUMBERS)");
> > exitcode = 1;
> > return 0;
>
> and place the free just before the return here so that we have a single
> uwinding exit.
<sigh>
I'll just make the change locally, given I *was* only 15 minutes
away from pushing this into the public repository.
-Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-12-20 23:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-11 11:08 [PATCH v2 0/4] xfsprogs misc fixes Vivek Trivedi
2015-12-11 11:09 ` [PATCH v2 1/4] xfsprogs: xfs_io: fix a memory leak in imap_f Vivek Trivedi
2015-12-20 15:33 ` Christoph Hellwig
2015-12-20 23:48 ` Dave Chinner [this message]
2015-12-11 11:09 ` [PATCH v2 2/4] xfsprogs: fix integer overflow in xlog_find_verify_cycle Vivek Trivedi
2015-12-20 15:35 ` Christoph Hellwig
2015-12-20 23:45 ` Dave Chinner
2015-12-11 11:09 ` [PATCH v2 3/4] xfsprogs: mkfs: fix unintentional integer overflow Vivek Trivedi
2015-12-20 15:36 ` Christoph Hellwig
2015-12-20 23:51 ` Dave Chinner
2015-12-11 11:09 ` [PATCH v2 4/4] xfsprogs: xfsdb: remove unnessary checks in process_leaf_node_dir_v2_free Vivek Trivedi
2015-12-20 15:37 ` Christoph Hellwig
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=20151220234830.GV26718@dastard \
--to=david@fromorbit.com \
--cc=a.sahrawat@samsung.com \
--cc=hch@infradead.org \
--cc=pankaj.m@samsung.com \
--cc=t.vivek@samsung.com \
--cc=xfs@oss.sgi.com \
/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