Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pkg_install/lib reset values when malloc fails.
details: https://anonhg.NetBSD.org/src/rev/3e21c50dea79
branches: trunk
changeset: 552325:3e21c50dea79
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 23 15:07:43 2003 +0000
description:
reset values when malloc fails.
diffstat:
usr.sbin/pkg_install/lib/fexec.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (33 lines):
diff -r b78c120f3466 -r 3e21c50dea79 usr.sbin/pkg_install/lib/fexec.c
--- a/usr.sbin/pkg_install/lib/fexec.c Tue Sep 23 15:06:40 2003 +0000
+++ b/usr.sbin/pkg_install/lib/fexec.c Tue Sep 23 15:07:43 2003 +0000
@@ -47,7 +47,7 @@
#include "lib.h"
#ifndef lint
-__RCSID("$NetBSD: fexec.c,v 1.6 2003/09/23 09:47:21 wiz Exp $");
+__RCSID("$NetBSD: fexec.c,v 1.7 2003/09/23 15:07:43 christos Exp $");
#endif
static int vfcexec(const char *, int, const char *, va_list);
@@ -64,7 +64,7 @@
if (argv == NULL) {
argv = malloc(max * sizeof(const char *));
if (argv == NULL) {
- warnx("vfcexec can't alloc arg space");
+ warn("vfcexec: Can't alloc arg space");
return -1;
}
}
@@ -80,8 +80,10 @@
new = max * 2;
ptr = realloc(argv, new * sizeof(const char *));
if (ptr == NULL) {
- warnx("vfcexec can't alloc arg space");
+ warn("vfcexec: Can't alloc arg space");
free(argv);
+ argv = NULL;
+ max = 4;
return -1;
}
argv = ptr;
Home |
Main Index |
Thread Index |
Old Index