diff --git a/src/calc.c b/src/calc.c index bef226e46c3fdabd8ab36363e1b5689844f3e47e..01b6971d6b94c13c95d611fb8024d80b427b1ccb 100644 --- a/src/calc.c +++ b/src/calc.c @@ -367,7 +367,7 @@ int calc_key(int ch) { int calc_process() { - char *path, *name; + char *path = NULL, *name = NULL; struct stat fs; struct dir *t; int n; @@ -494,7 +494,7 @@ int calc_process() { /* something went wrong... */ freedir(root); calc_fail: - if(!path[1] && strcmp(name, ".")) + if(name && path && !path[1] && strcmp(name, ".")) free(name); free(path);