Re: [PATCH] Fix leak indrivers/target/iscsi/iscsi_target_parameters.c::iscsi_copy_param_list()

From: Jesper Juhl
Date: Sun Jul 31 2011 - 18:33:55 EST


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@xxxxxxxxxxxxx>
> ---

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@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/