From: Dale Weiler Date: Fri, 21 Jun 2013 23:29:50 +0000 (+0000) Subject: cppcheck had the right idea, but the wrong scope on this one. X-Git-Tag: v0.3.0~96 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=684112474b4ff1eee2dde4aa3f84c8b6c52c612f;p=xonotic%2Fgmqcc.git cppcheck had the right idea, but the wrong scope on this one. --- diff --git a/test.c b/test.c index 1ebb33a..5f7eac7 100644 --- a/test.c +++ b/test.c @@ -325,6 +325,8 @@ static bool task_template_generate(task_template_t *tmpl, char tag, const char * */ if (value && *value && (*value == ' ' || *value == '\t')) value++; + else if (!value) + exit(EXIT_FAILURE); /* * Value will contain a newline character at the end, we need to strip @@ -332,8 +334,6 @@ static bool task_template_generate(task_template_t *tmpl, char tag, const char * */ if (strchr(value, '\n')) *strrchr(value, '\n')='\0'; - else /* cppcheck: possible nullpointer dereference */ - exit(EXIT_FAILURE); /* * Now allocate and set the actual value for the specific tag. Which