RE: [PATCH 1/1] hv: Use only one receive buffer per channel andkmalloc on initialize

From: Hank Janssen
Date: Mon Dec 13 2010 - 16:07:53 EST




> -----Original Message-----
> From: Jesper Juhl [mailto:jj@xxxxxxxxxxxxx]
> 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.

--
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/