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

Dan Carpenter error27 at gmail.com
Thu Apr 22 11:56:41 CEST 2010


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;
 		}
 	}


More information about the drbd-dev mailing list