aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAlfonso <gfunni234@gmail.com>2021-10-04 16:46:57 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2022-03-11 09:36:00 +0000
commit3322d1c0e25448563497acaa5c2358fe465765b8 (patch)
tree08f961775e4575212941cee91a2a870f2aedae23 /bin
parentc5f549c1e0c9aa1764e87d55f183053c1545b1fc (diff)
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 0c656d8a1544..89d90b78f2b0 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1096,8 +1096,7 @@ descendant_sort(KINFO *ki, int items)
* Now populate ki_d.prefix (instead of ki_d.level) with the command
* prefix used to show descendancies.
*/
- path = malloc((maxlvl + 7) / 8);
- memset(path, '\0', (maxlvl + 7) / 8);
+ path = calloc((maxlvl + 7) / 8, sizeof(unsigned char));
for (src = 0; src < items; src++) {
if ((lvl = ki[src].ki_d.level) == 0) {
ki[src].ki_d.prefix = NULL;