[Pkg-gnupg-commit] [gnupg2] 96/160: common: Smart up register_mem_cleanup_func.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Fri Jul 15 09:36:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch upstream
in repository gnupg2.
commit 6446a6b3dfd3b2e68b4285870f902ed1f86b0866
Author: Werner Koch <wk at gnupg.org>
Date: Fri Jul 1 14:42:18 2016 +0200
common: Smart up register_mem_cleanup_func.
* common/init.c (register_mem_cleanup_func): Avoid double registration.
Signed-off-by: Werner Koch <wk at gnupg.org>
---
common/init.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/init.c b/common/init.c
index c68a4e6..c406ffe 100644
--- a/common/init.c
+++ b/common/init.c
@@ -106,6 +106,10 @@ register_mem_cleanup_func (void (*func)(void))
{
mem_cleanup_item_t item;
+ for (item = mem_cleanup_list; item; item = item->next)
+ if (item->func == func)
+ return; /* Function has already been registered. */
+
item = malloc (sizeof *item);
if (item)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list