summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2019-09-16 09:48:20 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2019-09-20 07:11:14 +0000
commitd1704f8ef75a0e4e2dff36192648884817b6f076 (patch)
treefcacad41a07d8b7cb60afddf9b4a7111110f953d
parent2b77347cd95dc12475fe2af8a715097166d0523a (diff)
downloadillumos-joyent-d1704f8ef75a0e4e2dff36192648884817b6f076.tar.gz
11687 isaexec() leaks memory if realloc fails
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/lib/libc/port/gen/isaexec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr/src/lib/libc/port/gen/isaexec.c b/usr/src/lib/libc/port/gen/isaexec.c
index 9939b695f6..c3807ead39 100644
--- a/usr/src/lib/libc/port/gen/isaexec.c
+++ b/usr/src/lib/libc/port/gen/isaexec.c
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+ */
#pragma weak _isaexec = isaexec
@@ -67,9 +69,10 @@ isaexec(const char *execname, char *const *argv, char *const *envp)
}
if (ret > isalen) {
isalen = ret;
- isalist = realloc(isalist, isalen);
- } else
+ isalist = reallocf(isalist, isalen);
+ } else {
break;
+ }
} while (isalist != NULL);
if (isalist == NULL) {