[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1108010032410.28695@swampdragon.chaosbits.net>
Date:	Mon, 1 Aug 2011 00:33:45 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
cc:	Andy Grover <agrover@...hat.com>,
	Roland Dreier <roland@...nel.org>,
	Christoph Hellwig <hch@....de>, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix leak in
 drivers/target/iscsi/iscsi_target_parameters.c::iscsi_copy_param_list()
On Mon, 1 Aug 2011, Jesper Juhl wrote:
> We leak memory if the allocations for 'new_param->name' or 'new_param->value' fail.
> We also do a lot of variable assignments that are completely pointless
> if the allocations fail.
> So, let's move the allocations before the assignments and also make
> sure that we free whatever was allocated to one if the allocation for
> another fails.
> 
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
> ---
Forgot to mention that I changed the kzalloc's to kmalloc since we 
overwrite all the allocaed memory anyway, so asking for zeroed memory is 
just pointless extra work..
-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists