Module Name: src Committed By: kamil Date: Wed Sep 11 17:02:53 UTC 2019
Modified Files: src/bin/ps: ps.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/bin/ps/ps.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/ps/ps.c diff -u src/bin/ps/ps.c:1.91 src/bin/ps/ps.c:1.92 --- src/bin/ps/ps.c:1.91 Wed Apr 11 18:52:29 2018 +++ src/bin/ps/ps.c Wed Sep 11 17:02:53 2019 @@ -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. @@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19 #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #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 /* not lint */ @@ -525,6 +525,9 @@ main(int argc, char *argv[]) } } } + + free(pinfo); + return eval; }