From f209a252bc89349b0730cf809bcbf01cae6424ee Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 10 Feb 2013 21:17:07 +0000 Subject: [PATCH] when leak debugging, free everything even in builtins --- main.c | 8 +++++++- sh.h | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index b9c9d9c..abf902e 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.258 2013/02/10 19:05:37 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.259 2013/02/10 21:17:07 tg Exp $"); extern char **environ; @@ -1046,8 +1046,14 @@ cleanup_parents_env(void) afree(ep->savefd, &ep->area); ep->savefd = NULL; } +#ifdef DEBUG_LEAKS + if (ep->type != E_NONE) + ep->type = E_GONE; +#endif } +#ifndef DEBUG_LEAKS e->oenv = NULL; +#endif } /* Called just before an execve cleanup stuff temporary files */ diff --git a/sh.h b/sh.h index a74db6b..4570573 100644 --- a/sh.h +++ b/sh.h @@ -164,7 +164,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.632 2013/02/10 17:41:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.633 2013/02/10 21:17:07 tg Exp $"); #endif #define MKSH_VERSION "R41 2013/01/19" @@ -702,6 +702,7 @@ extern struct env { #define E_EXEC 4 /* executing command tree */ #define E_LOOP 5 /* executing for/while # */ #define E_ERRH 6 /* general error handler # */ +#define E_GONE 7 /* hidden in child */ /* # indicates env has valid jbuf (see unwind()) */ /* struct env.flag values */