summaryrefslogtreecommitdiffstats
path: root/lib/libedit/filecomplete.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-10-17 06:07:50 +0000
committerderaadt <deraadt@openbsd.org>2014-10-17 06:07:50 +0000
commit014b1be8e77af715a19974acd738d56ba2e3587d (patch)
tree57fcee9bf06edaf401c1d3bda9415c135b02cb20 /lib/libedit/filecomplete.c
parentIn the new world order, setperf does not exist on ramdisks. (diff)
downloadwireguard-openbsd-014b1be8e77af715a19974acd738d56ba2e3587d.tar.xz
wireguard-openbsd-014b1be8e77af715a19974acd738d56ba2e3587d.zip
Remove non-exposed malloc/realloc/free wrappers, and then substitute
reallocarray() where it helps. ok doug
Diffstat (limited to 'lib/libedit/filecomplete.c')
-rw-r--r--lib/libedit/filecomplete.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c
index a6de8de79fa..5eda39113c6 100644
--- a/lib/libedit/filecomplete.c
+++ b/lib/libedit/filecomplete.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filecomplete.c,v 1.3 2014/10/11 03:10:06 doug Exp $ */
+/* $OpenBSD: filecomplete.c,v 1.4 2014/10/17 06:07:50 deraadt Exp $ */
/* $NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $ */
/*-
@@ -433,11 +433,7 @@ fn_complete(EditLine *el,
ctemp--;
len = li->cursor - ctemp;
-#if defined(__SSP__) || defined(__SSP_ALL__)
- temp = malloc(sizeof(*temp) * (len + 1));
-#else
- temp = alloca(sizeof(*temp) * (len + 1));
-#endif
+ temp = reallocarray(NULL, len + 1, sizeof(*temp));
(void)Strncpy(temp, ctemp, len);
temp[len] = '\0';
@@ -552,9 +548,7 @@ fn_complete(EditLine *el,
free(matches);
matches = NULL;
}
-#if defined(__SSP__) || defined(__SSP_ALL__)
free(temp);
-#endif
return retval;
}