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/glob.c | |
parent | eef299572b3aae714384affd3dae3292c7325f78 (diff) |
realloc repair
Diffstat (limited to 'lib/libc/gen/glob.c')
-rw-r--r-- | lib/libc/gen/glob.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index 08ec8125cc1..bb222ebf909 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #else -static char rcsid[] = "$OpenBSD: glob.c,v 1.7 1998/01/31 17:06:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: glob.c,v 1.8 1998/08/14 21:39:30 deraadt Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -658,8 +658,11 @@ globextend(path, pglob) pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) : malloc(newsize); - if (pathv == NULL) + if (pathv == NULL) { + if (pglob->gl_pathv) + free(pglob->gl_pathv); return(GLOB_NOSPACE); + } if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { /* first time around -- clear initial gl_offs items */ |