[Pkg-gnupg-commit] [gnupg2] 147/205: common: Add 'free_strlist_wipe' which wipes memory.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit c6d1f2f08c68efe7e80887219064a8ce6365128f
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 21 12:59:59 2016 +0200

    common: Add 'free_strlist_wipe' which wipes memory.
    
    * common/strlist.c (free_strlist_wipe): New function.
    * common/strlist.h (free_strlist_wipe): New prototype.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 common/strlist.c | 14 ++++++++++++++
 common/strlist.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/common/strlist.c b/common/strlist.c
index 2ba0209..319d034 100644
--- a/common/strlist.c
+++ b/common/strlist.c
@@ -39,6 +39,7 @@
 #include "common-defs.h"
 #include "strlist.h"
 #include "utf8conv.h"
+#include "mischelp.h"
 
 void
 free_strlist( strlist_t sl )
@@ -52,6 +53,19 @@ free_strlist( strlist_t sl )
 }
 
 
+void
+free_strlist_wipe (strlist_t sl)
+{
+    strlist_t sl2;
+
+    for(; sl; sl = sl2 ) {
+	sl2 = sl->next;
+        wipememory (sl, sizeof *sl + strlen (sl->d));
+	xfree(sl);
+    }
+}
+
+
 /* Add STRING to the LIST at the front.  This function terminates the
    process on memory shortage.  */
 strlist_t
diff --git a/common/strlist.h b/common/strlist.h
index 94dd32f..45f5543 100644
--- a/common/strlist.h
+++ b/common/strlist.h
@@ -40,6 +40,8 @@ struct string_list
 typedef struct string_list *strlist_t;
 
 void    free_strlist (strlist_t sl);
+void	free_strlist_wipe (strlist_t sl);
+
 strlist_t add_to_strlist (strlist_t *list, const char *string);
 strlist_t add_to_strlist_try (strlist_t *list, const char *string);
 

-- 
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