summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-04-25 16:30:59 +0200
committerYorhel <git@yorhel.nl>2009-04-25 16:30:59 +0200
commitc079e0d23ae2379a5aee87075592fb55c90c7321 (patch)
tree2a3c2d658459d886067f1ca5b4260c76b01463f9
parent027c0c2eba92117dbb2ed6eced80e156c5fa5651 (diff)
Fixed another memory allocation issue
-rw-r--r--src/calc.c9
1 files changed, 8 insertions, 1 deletions
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))