[git] GnuPG - branch, master, updated. gnupg-2.1.11-150-g8776abb

by Werner Koch cvs at cvs.gnupg.org
Mon Apr 25 17:29:19 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  8776abbe02935e720018f3ef6ffd48f21435ff8b (commit)
      from  b8cb0973bcbe201a1e32a326dd97c3e72778b9d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8776abbe02935e720018f3ef6ffd48f21435ff8b
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Apr 25 17:26:57 2016 +0200

    common: Use new function to print a failure of xtrymalloc.
    
    * common/miscellaneous.c (xoutofcore): New.
    * common/strlist.c (append_to_strlist): Use instead of abort.
    (append_to_strlist_try): Use xtrymalloc instead of xmalloc.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/miscellaneous.c b/common/miscellaneous.c
index ec36f08..8d9a7aa 100644
--- a/common/miscellaneous.c
+++ b/common/miscellaneous.c
@@ -106,6 +106,17 @@ setup_libgcrypt_logging (void)
 }
 
 
+/* Print an out of core message and let the process die.  The printed
+ * error is taken from ERRNO.  */
+void
+xoutofcore (void)
+{
+  gpg_error_t err = gpg_error_from_syserror ();
+  log_fatal (_("error allocating enough memory: %s\n"), gpg_strerror (err));
+  abort (); /* Never called; just to make the compiler happy.  */
+}
+
+
 /* A wrapper around gcry_cipher_algo_name to return the string
    "AES-128" instead of "AES".  Given that we have an alias in
    libgcrypt for it, it does not harm to too much to return this other
diff --git a/common/strlist.c b/common/strlist.c
index 319d034..d4f8644 100644
--- a/common/strlist.c
+++ b/common/strlist.c
@@ -128,8 +128,8 @@ append_to_strlist( strlist_t *list, const char *string )
 {
   strlist_t sl;
   sl = append_to_strlist_try (list, string);
-  if (sl == NULL)
-    abort ();
+  if (!sl)
+    xoutofcore ();
   return sl;
 }
 
@@ -140,7 +140,7 @@ append_to_strlist_try (strlist_t *list, const char *string)
 {
     strlist_t r, sl;
 
-    sl = xmalloc( sizeof *sl + strlen(string));
+    sl = xtrymalloc( sizeof *sl + strlen(string));
     if (sl == NULL)
       return NULL;
 
diff --git a/common/util.h b/common/util.h
index 466c519..84a15ab 100644
--- a/common/util.h
+++ b/common/util.h
@@ -263,6 +263,9 @@ const char *gnupg_messages_locale_name (void);
    logging subsystem. */
 void setup_libgcrypt_logging (void);
 
+/* Print an out of core emssage and die.  */
+void xoutofcore (void);
+
 /* Same as estream_asprintf but die on memory failure.  */
 char *xasprintf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
 /* This is now an alias to estream_asprintf.  */

-----------------------------------------------------------------------

Summary of changes:
 common/miscellaneous.c | 11 +++++++++++
 common/strlist.c       |  6 +++---
 common/util.h          |  3 +++
 3 files changed, 17 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list