All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch] drbd: fix memory leak
Date: Thu, 22 Apr 2010 09:56:41 +0000	[thread overview]
Message-ID: <20100422095641.GR29647@bicker> (raw)

We leak memory if "--dry-run" is not supported by the peer.

Signed-off-by: Dan Carpenter <error27@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;
 		}
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Lars Ellenberg <drbd-dev@lists.linbit.com>
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>,
	kernel-janitors@vger.kernel.org,
	Philipp Reisner <philipp.reisner@linbit.com>,
	drbd-user@lists.linbit.com, Jens Axboe <jens.axboe@oracle.com>
Subject: [Drbd-dev] [patch] drbd: fix memory leak
Date: Thu, 22 Apr 2010 11:56:41 +0200	[thread overview]
Message-ID: <20100422095641.GR29647@bicker> (raw)

We leak memory if "--dry-run" is not supported by the peer.

Signed-off-by: Dan Carpenter <error27@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;
 		}
 	}

             reply	other threads:[~2010-04-22  9:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22  9:56 Dan Carpenter [this message]
2010-04-22  9:56 ` [Drbd-dev] [patch] drbd: fix memory leak Dan Carpenter
2010-04-22 12:27 ` Jens Axboe
2010-04-22 12:27   ` [Drbd-dev] " Jens Axboe
2010-04-22 12:47 ` Philipp Reisner
2010-04-22 12:47   ` [Drbd-dev] " Philipp Reisner
2010-04-22 12:50 ` Jens Axboe
2010-04-22 12:50   ` [Drbd-dev] " Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2010-04-22 12:47 [PATCH 1/1] drbd: Terminate a connection early if sending the protocol fails Philipp Reisner
2010-04-22 12:47 ` [Drbd-dev] " Philipp Reisner
2024-11-27 11:20 [PATCH] drbd: Fix memory leak zhengbing.huang
2024-12-13 15:59 ` Joel Colledge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100422095641.GR29647@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.