From: Zhao Lei <zhaolei@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>
Subject: RE: [PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show
Date: Mon, 2 Nov 2015 09:16:18 +0800 [thread overview]
Message-ID: <028c01d1150c$1ab38ae0$501aa0a0$@cn.fujitsu.com> (raw)
In-Reply-To: <20151030133554.GF13624@twin.jikos.cz>
Hi, David Sterba
> -----Original Message-----
> From: David Sterba [mailto:dsterba@suse.cz]
> Sent: Friday, October 30, 2015 9:36 PM
> To: Zhao Lei <zhaolei@cn.fujitsu.com>
> Cc: linux-btrfs@vger.kernel.org
> Subject: Re: [PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show
>
> On Thu, Oct 29, 2015 at 05:31:47PM +0800, Zhao Lei wrote:
> > comparer_set, which was allocated by malloc(), should be free before
> > function return.
> >
> > Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> > ---
> > cmds-qgroup.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/cmds-qgroup.c b/cmds-qgroup.c index a64b716..f069d32
> > 100644
> > --- a/cmds-qgroup.c
> > +++ b/cmds-qgroup.c
> > @@ -290,7 +290,7 @@ static int cmd_qgroup_show(int argc, char **argv)
> > int filter_flag = 0;
> > unsigned unit_mode;
> >
> > - struct btrfs_qgroup_comparer_set *comparer_set;
> > + struct btrfs_qgroup_comparer_set *comparer_set = NULL;
> > struct btrfs_qgroup_filter_set *filter_set;
> > filter_set = btrfs_qgroup_alloc_filter_set();
> > comparer_set = btrfs_qgroup_alloc_comparer_set();
> > @@ -372,6 +372,8 @@ static int cmd_qgroup_show(int argc, char **argv)
> > fprintf(stderr, "ERROR: can't list qgroups: %s\n",
> > strerror(e));
> >
> > + free(comparer_set);
>
> Doh, coverity correctly found that comparer_set is freed inside
> btrfs_show_qgroups() a few lines above. Patch dropped.
>
My bad.
This problem is find in my node by valgrind memckeck, maybe it
is not freed in some case, or a valgrind misreport.
I'll check it deeply.
Thanks
Zhaolei
> > +
next prev parent reply other threads:[~2015-11-02 1:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 9:31 [PATCH 1/6] btrfs-progs: fix floating point exception for btrfs-calc-size Zhao Lei
2015-10-29 9:31 ` [PATCH 2/6] btrfs-progs: Fix negative eb's ref_cnt in btrfs-calc-size Zhao Lei
2015-10-29 9:31 ` [PATCH 3/6] btrfs-progs: free fslabel for btrfs-convert Zhao Lei
2015-10-29 13:08 ` David Sterba
2015-10-29 9:31 ` [PATCH 4/6] btrfs-progs: Fix uninitialized key.type for btrfs_find_free_objectid Zhao Lei
2015-10-29 9:31 ` [PATCH 5/6] btrfs-progs: free comparer_set in cmd_qgroup_show Zhao Lei
2015-10-30 13:35 ` David Sterba
2015-11-02 1:16 ` Zhao Lei [this message]
2015-10-29 9:31 ` [PATCH 6/6] btrfs-progs: Avoid use pointer in handle_options Zhao Lei
2015-10-29 13:15 ` David Sterba
2015-10-29 13:26 ` [PATCH 1/6] btrfs-progs: fix floating point exception for btrfs-calc-size David Sterba
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='028c01d1150c$1ab38ae0$501aa0a0$@cn.fujitsu.com' \
--to=zhaolei@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).