[lkml]   [2011]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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 <>
> ---

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 <>
Don't top-post
Plain text mails only, please.

 \ /
  Last update: 2011-08-01 00:37    [from the cache]
©2003-2011 Jasper Spaans