Fix a warning and potential segfault in lash when BB_FEATURE_CLEAN_UP
authorEric Andersen <andersen@codepoet.org>
Wed, 22 Aug 2001 05:32:24 +0000 (05:32 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 22 Aug 2001 05:32:24 +0000 (05:32 -0000)
is enabled

lash.c
shell/lash.c

diff --git a/lash.c b/lash.c
index 0af669116006455ccd0347773f4397f1f85d86a2..22e3c779eec2e95aef0a4ac2db52c09519c43e97 100644 (file)
--- 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);
index 0af669116006455ccd0347773f4397f1f85d86a2..22e3c779eec2e95aef0a4ac2db52c09519c43e97 100644 (file)
@@ -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);