aboutsummaryrefslogtreecommitdiffstats
path: root/common/exechelp-posix.c
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-09-05 13:33:51 +0000
committerJustus Winter <[email protected]>2016-09-05 15:26:50 +0000
commit845e2cc201d6a2cdb151e39e29516d26cb49311c (patch)
treeb82aeeae16f8df7ada1c7f5590ef756bdfa5dafe /common/exechelp-posix.c
parentg10: Don't add user attributes to the TOFU DB. (diff)
downloadgnupg-845e2cc201d6a2cdb151e39e29516d26cb49311c.tar.gz
gnupg-845e2cc201d6a2cdb151e39e29516d26cb49311c.zip
common: Fix error handling.
* common/exechelp-posix.c (store_result): Use xtrymalloc. (gnupg_wait_processes): Likewise, and check result. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r--common/exechelp-posix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index 32c420318..56380f2c5 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++)
{