From 3b4a1996730e8534980fa19e41996b6d6c2738b6 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 17 Oct 2011 09:50:14 +0200 Subject: [PATCH] Fix null pointer crash while encountering configuration file errors during parsing. --- src/util/config_token.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/config_token.c b/src/util/config_token.c index 4c9fae0..fefc5bd 100644 --- a/src/util/config_token.c +++ b/src/util/config_token.c @@ -120,9 +120,12 @@ struct cfg_tokens* cfg_tokenize(const char* line) void cfg_tokens_free(struct cfg_tokens* tokens) { - list_clear(tokens->list, hub_free); - list_destroy(tokens->list); - hub_free(tokens); + if (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)