Messages in this thread | | | Date | Mon, 1 Aug 2011 00:33:45 +0200 (CEST) | From | Jesper Juhl <> | 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@chaosbits.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@chaosbits.net> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
| |