Only call free if it is necessary
authorEric Andersen <andersen@codepoet.org>
Tue, 14 Jan 2003 06:40:11 +0000 (06:40 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 14 Jan 2003 06:40:11 +0000 (06:40 -0000)
shell/ash.c

index 01a02d375c85bfdc0acf53cb5e63a61d08ceaa96..828a888726604cabe7aab5a8c25be4b699bfaecc 100644 (file)
@@ -1830,7 +1830,8 @@ static void setpwd(const char *val, int setold)
                getpwd();
        else
                curdir = simplify_path(val);
-       free(cated);
+       if (cated)
+               free(cated);
        INTON;
        setvar("PWD", curdir, VEXPORT);
 }