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 0af6691..22e3c77 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 0af6691..22e3c77 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);