mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: libolingjl@163.com
To: davem@davemloft.net, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, liboling <libolingjl@163.com>
Subject: [PATCH] samples cn_test: fix cn leakage
Date: Fri, 26 Jun 2020 11:52:14 +0800	[thread overview]
Message-ID: <20200626035214.22709-1-libolingjl@163.com> (raw)

From: liboling <libolingjl@163.com>

Error return when add the second cn_test_id,
we need del the first cn_test_id.

Signed-off-by: liboling <libolingjl@163.com>
---
 samples/connector/cn_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/samples/connector/cn_test.c b/samples/connector/cn_test.c
index 0958a171d0..275e3f9082 100644
--- a/samples/connector/cn_test.c
+++ b/samples/connector/cn_test.c
@@ -151,6 +151,7 @@ static int cn_test_init(void)
 	cn_test_id.val++;
 	err = cn_add_callback(&cn_test_id, cn_test_name, cn_test_callback);
 	if (err) {
+		cn_test_id.val--;
 		cn_del_callback(&cn_test_id);
 		goto err_out;
 	}
-- 
2.17.1



                 reply	other threads:[~2020-06-26  3:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200626035214.22709-1-libolingjl@163.com \
    --to=libolingjl@163.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®