From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm-tool] controld: fix memory leak
Date: Thu, 23 Jun 2022 13:25:30 -0400 [thread overview]
Message-ID: <20220623172530.2073884-1-aahringo@redhat.com> (raw)
Compile with -fsanitize=address unveils the following memory leak:
==1175==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 216 byte(s) in 3 object(s) allocated from:
#0 0x7f0881809b17 in calloc (/lib64/libasan.so.6+0xaeb17)
#1 0x55b3f110bc78 in send_protocol /builddir/devel/dlm/dlm_controld/daemon_cpg.c:1872
SUMMARY: AddressSanitizer: 216 byte(s) leaked in 3 allocation(s).
This patch free's the allocated buffer in send_protocol which should be
copied in a different buffer by _send_message() already.
---
dlm_controld/daemon_cpg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index f215edfd..e6a03a28 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -1886,6 +1886,7 @@ static void send_protocol(struct protocol *proto)
protocol_out(pr);
_send_message(cpg_handle_daemon, buf, len, DLM_MSG_PROTOCOL);
+ free(buf);
}
int set_protocol(void)
--
2.31.1
reply other threads:[~2022-06-23 17:25 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=20220623172530.2073884-1-aahringo@redhat.com \
--to=aahringo@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).