diff options
author | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-08-02 20:33:50 +0000 |
commit | 7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8 (patch) | |
tree | 8901b5966bac844405a560018181d94cc4eccd35 /pkgtools/pkg_install/files/lib/fexec.c | |
parent | f3a58140319f67643ea733850de213b695037b07 (diff) | |
download | pkgsrc-7be93b44a0d2e33aa0dd07de5f5b673bf95b27c8.tar.gz |
Most memory allocation failures were fatal already and the majority of
the rest lacked an explicit check. Add the usual x* wrappers around
malloc and friends that explicitly terminate on error and use them in
all but Dewey.
Diffstat (limited to 'pkgtools/pkg_install/files/lib/fexec.c')
-rw-r--r-- | pkgtools/pkg_install/files/lib/fexec.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkgtools/pkg_install/files/lib/fexec.c b/pkgtools/pkg_install/files/lib/fexec.c index c8c5185f9fc..b3b6a9da11f 100644 --- a/pkgtools/pkg_install/files/lib/fexec.c +++ b/pkgtools/pkg_install/files/lib/fexec.c @@ -58,7 +58,7 @@ #include "lib.h" #ifndef lint -__RCSID("$NetBSD: fexec.c,v 1.9.8.1 2008/05/23 15:57:04 joerg Exp $"); +__RCSID("$NetBSD: fexec.c,v 1.9.8.2 2008/08/02 20:33:50 joerg Exp $"); #endif static int vfcexec(const char *, int, const char *, va_list); @@ -106,8 +106,7 @@ vfcexec(const char *path, int skipempty, const char *arg, va_list ap) int retval; argv_size = 16; - if ((argv = malloc(argv_size * sizeof(*argv))) == NULL) - err(EXIT_FAILURE, "vfcexec: malloc failed"); + argv = xcalloc(argv_size, sizeof(*argv)); argv[0] = arg; argc = 1; @@ -115,9 +114,7 @@ vfcexec(const char *path, int skipempty, const char *arg, va_list ap) do { if (argc == argv_size) { argv_size *= 2; - argv = realloc(argv, argv_size * sizeof(*argv)); - if (argv == NULL) - err(EXIT_FAILURE, "vfcexec: realloc failed"); + argv = xrealloc(argv, argv_size * sizeof(*argv)); } arg = va_arg(ap, const char *); if (skipempty && arg && strlen(arg) == 0) |