aboutsummaryrefslogtreecommitdiffstats
path: root/guts/execle.c
diff options
context:
space:
mode:
Diffstat (limited to 'guts/execle.c')
-rw-r--r--guts/execle.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/guts/execle.c b/guts/execle.c
index f4c2ea7..13fbfb9 100644
--- a/guts/execle.c
+++ b/guts/execle.c
@@ -11,6 +11,12 @@
size_t alloc_size = 256;
const char **argv = malloc(sizeof (const char *) * alloc_size);
char *const *envp;
+ if (!argv) {
+ pseudo_debug(1, "execle failed: couldn't allocate memory for %lu arguments\n",
+ (unsigned long) alloc_size);
+ errno = ENOMEM;
+ return -1;
+ }
argv[i++] = arg;
@@ -19,6 +25,12 @@
if ( i > alloc_size - 1 ) {
alloc_size = alloc_size + 256;
argv = realloc(argv, sizeof (const char *) * alloc_size);
+ if (!argv) {
+ pseudo_debug(1, "execle failed: couldn't allocate memory for %lu arguments\n",
+ (unsigned long) alloc_size);
+ errno = ENOMEM;
+ return -1;
+ }
}
}
envp = va_arg (ap, char *const *);