aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c
index 052acb4..d8ad576 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -73,7 +73,8 @@ void parse_config()
assert((size_t)(tail - buf) <= file_size);
++tail;
}
- head = tail+1;;
+
+ head = tail++;
continue;
}
else if (*tail == '=')
@@ -119,11 +120,23 @@ void parse_config()
}
else if (!strcmp(key, "project.script"))
{
- config.projects[config.project_count-1].script_path = strdup(value);
+ if (config.project_count > 0)
+ {
+ if (config.projects[config.project_count-1].script_path)
+ free(config.projects[config.project_count-1].script_path);
+
+ config.projects[config.project_count-1].script_path = strdup(value);
+ }
}
else if (!strcmp(key, "project.description"))
{
- config.projects[config.project_count-1].description = strdup(value);
+ if (config.project_count > 0)
+ {
+ if (config.projects[config.project_count-1].description)
+ free(config.projects[config.project_count-1].description);
+
+ config.projects[config.project_count-1].description = strdup(value);
+ }
}
key = NULL;