From 912646fc08d1b5e497f5ddb9b14e994f6b44e291 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 9 Feb 2018 09:03:34 -0600 Subject: Andreas Gampe suggested a different fix. (Bionic _does_ do the malloc(0)!=0 thing, the problem is pedantic access checking, not null dereference. So test count instead.) --- toys/posix/ps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toys') diff --git a/toys/posix/ps.c b/toys/posix/ps.c index 8ee68ad6..e94902b3 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1417,7 +1417,8 @@ static void top_common( mix.count = 0; while (old.count || new.count) { - struct carveup *otb = old.tb ? *old.tb : 0, *ntb = new.tb ? *new.tb : 0; + struct carveup *otb = old.count ? *old.tb : 0, + *ntb = new.count ? *new.tb : 0; // If we just have old for this process, it exited. Discard it. if (old.count && (!new.count || *otb->slot < *ntb->slot)) { -- cgit v1.2.3