Commit 5511e2a7 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Fixed a use-after-free error found by valgrind. This could only

be triggered by a broken aux-item definition file, so it was
mostly harmless.
* src/server/aux-item-def-parse.y (aux_item_def_check_validate):
Don't free a string before using it.
parent 225b29e4
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
mostly harmless. mostly harmless.
* src/server/aux-item-def-parse.y (aux_item_def_check_trigger): * src/server/aux-item-def-parse.y (aux_item_def_check_trigger):
Don't free a string before using it. Don't free a string before using it.
(aux_item_def_check_validate): Ditto.
   
Fixed various harmless memory and file descriptor leaks found by Fixed various harmless memory and file descriptor leaks found by
valgrind. valgrind.
......
...@@ -633,15 +633,16 @@ static void aux_item_def_check_validate(int *found, ...@@ -633,15 +633,16 @@ static void aux_item_def_check_validate(int *found,
{ {
tmp_string = s_crea_c_str(data); tmp_string = s_crea_c_str(data);
validator = aux_item_find_validator(tmp_string); validator = aux_item_find_validator(tmp_string);
string_free(tmp_string);
if (validator == NULL) if (validator == NULL)
{ {
yyerror("undefined function: %s", yyerror("undefined function: %s",
tmp_string); tmp_string);
string_free(tmp_string);
return; return;
} }
string_free(tmp_string);
def->num_validators += 1; def->num_validators += 1;
def->validators = srealloc(def->validators, def->validators = srealloc(def->validators,
def->num_validators * def->num_validators *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment