From: Eric Andersen Date: Wed, 22 Aug 2001 05:32:24 +0000 (-0000) Subject: Fix a warning and potential segfault in lash when BB_FEATURE_CLEAN_UP X-Git-Tag: 0_60_1~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5d60a462694ae4ab24fdbc903859949886c90805;p=oweals%2Fbusybox.git Fix a warning and potential segfault in lash when BB_FEATURE_CLEAN_UP is enabled --- diff --git a/lash.c b/lash.c index 0af669116..22e3c779e 100644 --- a/lash.c +++ b/lash.c @@ -1507,8 +1507,8 @@ static int busy_loop(FILE * input) #ifdef BB_FEATURE_CLEAN_UP void free_memory(void) { - if (cwd) { - free(cwd); + if (cwd && cwd!=unknown) { + free((char*)cwd); } if (local_pending_command) free(local_pending_command); diff --git a/shell/lash.c b/shell/lash.c index 0af669116..22e3c779e 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -1507,8 +1507,8 @@ static int busy_loop(FILE * input) #ifdef BB_FEATURE_CLEAN_UP void free_memory(void) { - if (cwd) { - free(cwd); + if (cwd && cwd!=unknown) { + free((char*)cwd); } if (local_pending_command) free(local_pending_command);