[Pkg-gnupg-commit] [gnupg2] 72/118: common: Fix error handling.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 15 18:25:11 UTC 2016


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

dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.

commit 845e2cc201d6a2cdb151e39e29516d26cb49311c
Author: Justus Winter <justus at g10code.com>
Date:   Mon Sep 5 15:33:51 2016 +0200

    common: Fix error handling.
    
    * common/exechelp-posix.c (store_result): Use xtrymalloc.
    (gnupg_wait_processes): Likewise, and check result.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 common/exechelp-posix.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index 32c4203..56380f2 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -610,7 +610,7 @@ store_result (pid_t pid, int exitcode)
 {
   struct terminated_child *c;
 
-  c = xmalloc (sizeof *c);
+  c = xtrymalloc (sizeof *c);
   if (c == NULL)
     return gpg_err_code_from_syserror ();
 
@@ -660,7 +660,11 @@ gnupg_wait_processes (const char **pgmnames, pid_t *pids, size_t count,
   int *dummy = NULL;
 
   if (r_exitcodes == NULL)
-    dummy = r_exitcodes = xmalloc (sizeof *r_exitcodes * count);
+    {
+      dummy = r_exitcodes = xtrymalloc (sizeof *r_exitcodes * count);
+      if (dummy == NULL)
+        return gpg_err_code_from_syserror ();
+    }
 
   for (i = 0, left = count; i < count; i++)
     {

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