summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdw <>2010-11-27 10:34:31 +0000
committerpdw <>2010-11-27 10:34:31 +0000
commit6d594acbd60ce301085ceb59d0981eba2cdaaf14 (patch)
tree7a436bee90aaad0a7fb216e62fc12524addcbb28
parent950623a9d15ab27963f165bd2ea8a9a57bfb775c (diff)
downloadiftop-6d594acbd60ce301085ceb59d0981eba2cdaaf14.zip
Fixed segfault / hang when specifying -i option twice.
-rw-r--r--cfgfile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cfgfile.c b/cfgfile.c
index 0a77965..38922db 100644
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -230,8 +230,13 @@ void config_set_string(const char *directive, const char* s) {
stringmap S;
S = stringmap_find(config, directive);
- if (S) stringmap_delete_free(S);
- stringmap_insert(config, directive, item_ptr(xstrdup(s)));
+ if (S) {
+ xfree(S->d.v);
+ S->d = item_ptr(xstrdup(s));
+ }
+ else {
+ stringmap_insert(config, directive, item_ptr(xstrdup(s)));
+ }
}
int read_config(char *file, int whinge_on_error) {