From 8776abbe02935e720018f3ef6ffd48f21435ff8b Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 25 Apr 2016 17:26:57 +0200 Subject: 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 --- common/miscellaneous.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'common/miscellaneous.c') diff --git a/common/miscellaneous.c b/common/miscellaneous.c index ec36f08ea..8d9a7aa73 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 -- cgit v1.2.3