Plug memory leak in ps(1)
pinfo is allocated in setpinfo() with calloc(3). Free it when no longer used, just before the program termination. Detected with LSan.
This commit is contained in:
parent
0b2edbc9d5
commit
fd0c6ecff6
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $ */
|
/* $NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
|
||||||
|
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
|
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $");
|
__RCSID("$NetBSD: ps.c,v 1.92 2019/09/11 17:02:53 kamil Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -525,6 +525,9 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(pinfo);
|
||||||
|
|
||||||
return eval;
|
return eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue