mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-25 07:49:18 +00:00
ps(1): Use calloc instead of malloc and memset.
Pull Request: https://github.com/freebsd/freebsd-src/pull/546 MFC after: 1 week Sponsored by: NVIDIA Networking
This commit is contained in:
parent
c5f549c1e0
commit
3322d1c0e2
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user