Fix null pointer crash while encountering configuration file errors during parsing.

This commit is contained in:
Jan Vidar Krey 2011-10-17 09:50:14 +02:00
parent f8d057f15a
commit 3b4a199673
1 changed files with 6 additions and 3 deletions

View File

@ -119,11 +119,14 @@ struct cfg_tokens* cfg_tokenize(const char* line)
} }
void cfg_tokens_free(struct cfg_tokens* tokens) void cfg_tokens_free(struct cfg_tokens* tokens)
{
if (tokens)
{ {
list_clear(tokens->list, hub_free); list_clear(tokens->list, hub_free);
list_destroy(tokens->list); list_destroy(tokens->list);
hub_free(tokens); 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)
{ {