when leak debugging, free everything even in builtins

This commit is contained in:
tg 2013-02-10 21:17:07 +00:00
parent 51345bd33b
commit f209a252bc
2 changed files with 9 additions and 2 deletions

8
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#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 */

3
sh.h
View File

@ -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 */