diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-14 21:39:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-14 21:39:45 +0000 |
commit | fbe7a4e21ce2effe646980ca1214c125d94c70fd (patch) | |
tree | 50eb4ae3c83a05be96515dfbe68af415625afbfa /lib/libc/gen/getpwent.c | |
parent | eef299572b3aae714384affd3dae3292c7325f78 (diff) |
realloc repair
Diffstat (limited to 'lib/libc/gen/getpwent.c')
-rw-r--r-- | lib/libc/gen/getpwent.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 4144b356bbb..2b1b0d324e7 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getpwent.c,v 1.13 1998/07/14 18:19:16 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: getpwent.c,v 1.14 1998/08/14 21:39:29 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -969,10 +969,17 @@ __hashpw(key) return(0); p = (char *)data.data; if (data.size > max) { + char *nline; + max = data.size + 256; - line = realloc(line, max); - if (line == NULL) + nline = realloc(line, max); + if (nline == NULL) { + if (line) + free(line); + line = NULL; return 0; + } + line = nline; } t = line; |