[Drbd-dev] [patch] drbd: fix memory leak

Jens Axboe jens.axboe at oracle.com
Thu Apr 22 14:27:19 CEST 2010


On Thu, Apr 22 2010, Dan Carpenter wrote:
> We leak memory if "--dry-run" is not supported by the peer.
> 
> Signed-off-by: Dan Carpenter <error27 at gmail.com>
> 
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index 67e0fc5..93d1f9b 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -1695,6 +1695,7 @@ int drbd_send_protocol(struct drbd_conf *mdev)
>  			cf |= CF_DRY_RUN;
>  		else {
>  			dev_err(DEV, "--dry-run is not supported by peer");
> +			kfree(p);
>  			return 0;
>  		}
>  	}

Yep, that's a leak. I have applied it for 2.6.34.

-- 
Jens Axboe



More information about the drbd-dev mailing list