lkml.org 
[lkml]   [2010]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 1/1] hv: Use only one receive buffer per channel and kmalloc on initialize
Date


> -----Original Message-----
> From: Jesper Juhl [mailto:jj@chaosbits.net]
> Sent: Monday, December 13, 2010 12:48 PM
> You are leaking memory in the failure path. If for example one or two
> allocations succeed but one or two fail, then you'll leak the two successful
> allocations.
>
> I believe this should be
>
> if (!shut_txf_buf || !time_txf_buf || !hbeat_txf_buf) {
> printk(KERN_INFO
> "Unable to allocate memory for receive buffer\n");
> kfree(hbeat_txf_buf);
> kfree(time_txf_buf);
> kfree(shut_txf_buf);
> return -ENOMEM;
> ...
>

Oops, you are correct. Resubmitting the patch in a few minutes.

Hank.



\
 
 \ /
  Last update: 2010-12-13 22:09    [W:0.097 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site