git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] chdir-notify: UNLEAK registrated callback entries
@ 2020-11-14 21:40 René Scharfe
  2020-11-14 21:53 ` René Scharfe
  2020-11-17  0:24 ` Jeff King
  0 siblings, 2 replies; 8+ messages in thread
From: René Scharfe @ 2020-11-14 21:40 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jeff King

chdir_notify_register() allows registering functions to notify when
chdir() is called.  There is no way to unsubscribe or shut this
mechanism down, so these entries are present until the program ends.

Valgrind reports allocations for these registrations as "possibly lost",
probably because it doesn't see through list.h's offsetof tricks.
Annotate them using UNLEAK, which causes Valgrind to report them as
"still reachable" instead.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 chdir-notify.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/chdir-notify.c b/chdir-notify.c
index 5f7f2c2ac2..b236288416 100644
--- a/chdir-notify.c
+++ b/chdir-notify.c
@@ -16,6 +16,7 @@ void chdir_notify_register(const char *name,
 			   void *data)
 {
 	struct chdir_notify_entry *e = xmalloc(sizeof(*e));
+	UNLEAK(e);
 	e->name = name;
 	e->cb = cb;
 	e->data = data;
--
2.29.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-17 18:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-14 21:40 [PATCH] chdir-notify: UNLEAK registrated callback entries René Scharfe
2020-11-14 21:53 ` René Scharfe
2020-11-16 21:59   ` Junio C Hamano
2020-11-17  4:49   ` Elijah Newren
2020-11-17  6:53     ` Jeff King
2020-11-17  8:39       ` Elijah Newren
2020-11-17  0:24 ` Jeff King
2020-11-17 18:45   ` René Scharfe

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).