[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200714141017.GQ3703@twin.jikos.cz>
Date: Tue, 14 Jul 2020 16:10:17 +0200
From: David Sterba <dsterba@...e.cz>
To: trix@...hat.com
Cc: clm@...com, josef@...icpanda.com, dsterba@...e.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs : fix memory leak in add_block_entry
On Tue, Jul 07, 2020 at 06:29:08AM -0700, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis flags this error
>
> fs/btrfs/ref-verify.c:290:3: warning: Potential leak of memory pointed to by 're' [unix.Malloc]
> kfree(be);
> ^~~~~
> The problem is in this block of code
>
> if (root_objectid) {
> struct root_entry *exist_re;
>
> exist_re = insert_root_entry(&exist->roots, re);
> if (exist_re)
> kfree(re);
> }
>
> There is no 'else' block freeing when root_objectid == 0
>
> So add an 'else'
>
> Fixes: fd708b81d972 ("Btrfs: add a extent ref verify tool")
>
> Signed-off-by: Tom Rix <trix@...hat.com>
Added to misc-next, thanks.
Powered by blists - more mailing lists