BUGFIX: libconfig doesn't manage memory for ints

This commit is contained in:
Alex D. 2020-12-30 20:28:21 +00:00
parent 101b515d59
commit 6658bd9aa4
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 4 additions and 4 deletions

View File

@ -36,10 +36,10 @@ parse_configfile(char* config_path, Connection* conn)
};
mapconf(root, rootmaps, sizeof(rootmaps) / sizeof(*rootmaps));
// Timeout is saved as a time_t (long)
int* tmp = NULL;
config_setting_lookup_int(root, "timeout", tmp);
if (tmp != NULL) conn->data.timeout = *tmp;
// Timeout is saved as a time_t (long) and may not be negative, 0 is default (unset)
signed int tmp = -1;
config_setting_lookup_int(root, "timeout", &tmp);
if (tmp > 0) conn->data.timeout = tmp;
// Channels are a array
config_setting_t* chans;