Fix null pointer crash while encountering configuration file errors during parsing.
This commit is contained in:
parent
f8d057f15a
commit
3b4a199673
@ -120,9 +120,12 @@ struct cfg_tokens* cfg_tokenize(const char* line)
|
|||||||
|
|
||||||
void cfg_tokens_free(struct cfg_tokens* tokens)
|
void cfg_tokens_free(struct cfg_tokens* tokens)
|
||||||
{
|
{
|
||||||
list_clear(tokens->list, hub_free);
|
if (tokens)
|
||||||
list_destroy(tokens->list);
|
{
|
||||||
hub_free(tokens);
|
list_clear(tokens->list, hub_free);
|
||||||
|
list_destroy(tokens->list);
|
||||||
|
hub_free(tokens);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cfg_token_add(struct cfg_tokens* tokens, char* new_token)
|
int cfg_token_add(struct cfg_tokens* tokens, char* new_token)
|
||||||
|
Loading…
Reference in New Issue
Block a user