Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ps Plug memory leak in ps(1)
details:   https://anonhg.NetBSD.org/src/rev/d19978875c47
branches:  trunk
changeset: 1003324:d19978875c47
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Sep 11 17:02:53 2019 +0000
description:
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.
diffstat:
 bin/ps/ps.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 014d9ba60af7 -r d19978875c47 bin/ps/ps.c
--- a/bin/ps/ps.c       Wed Sep 11 15:03:52 2019 +0000
+++ b/bin/ps/ps.c       Wed Sep 11 17:02:53 2019 +0000
@@ -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 @@
 #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 @@
                        }
                }
        }
+
+       free(pinfo);
+
        return eval;
 }
 
Home |
Main Index |
Thread Index |
Old Index