From e4e5229513bc2d56db4e1b6cb1ff8b97b87f35fd Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 2 Apr 2011 13:55:35 +0000 Subject: [PATCH] shut up valgrind, thanks wbx@ for prodding --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index ef32c4e..071e0fb 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.187 2011/03/27 18:50:05 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.188 2011/04/02 13:55:35 tg Exp $"); extern char **environ; @@ -112,6 +112,10 @@ rndsetup(void) char *cp; cp = alloc(sizeof(*bufptr) - ALLOC_SIZE, APERM); +#ifdef DEBUG + /* clear the allocated space, for valgrind */ + memset(cp, 0, sizeof(*bufptr) - ALLOC_SIZE); +#endif /* undo what alloc() did to the malloc result address */ bufptr = (void *)(cp - ALLOC_SIZE); /* PIE or something similar provides us with deltas here */