From c079e0d23ae2379a5aee87075592fb55c90c7321 Mon Sep 17 00:00:00 2001 From: Yorhel <git@yorhel.nl> Date: Sat, 25 Apr 2009 16:30:59 +0200 Subject: [PATCH] Fixed another memory allocation issue --- src/calc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calc.c b/src/calc.c index 9601d10..8ae299e 100644 --- a/src/calc.c +++ b/src/calc.c @@ -342,10 +342,16 @@ void calc_process() { } root = t; curdev = fs.st_dev; - free(path); /* start calculating */ if(!calc_dir(root, name) && !failed) { + free(path); + if(root->sub == NULL) { + freedir(root); + failed = 1; + strcpy(errmsg, "Directory empty."); + goto calc_fail; + } browse_init(root->sub); /* update references and free original item */ @@ -373,6 +379,7 @@ void calc_process() { } /* something went wrong... */ + free(path); freedir(root); calc_fail: while(failed && !input_handle(0)) -- GitLab