Commit aa5110c0 authored by Bjorn Munch's avatar Bjorn Munch

Bug #59153 mysqltest produces a valgrind warning when the running test fails

Local variable ds_warnings in run_query not cleared.
But when we call die() we don't have access to it.
Set global var. to point to it when allocated.
parent 2a56b1b0
...@@ -468,6 +468,8 @@ TYPELIB command_typelib= {array_elements(command_names),"", ...@@ -468,6 +468,8 @@ TYPELIB command_typelib= {array_elements(command_names),"",
command_names, 0}; command_names, 0};
DYNAMIC_STRING ds_res; DYNAMIC_STRING ds_res;
/* Points to ds_warning in run_query, so it can be freed */
DYNAMIC_STRING *ds_warn= 0;
char builtin_echo[FN_REFLEN]; char builtin_echo[FN_REFLEN];
...@@ -1275,6 +1277,8 @@ void free_used_memory() ...@@ -1275,6 +1277,8 @@ void free_used_memory()
my_free(embedded_server_args[--embedded_server_arg_count]); my_free(embedded_server_args[--embedded_server_arg_count]);
delete_dynamic(&q_lines); delete_dynamic(&q_lines);
dynstr_free(&ds_res); dynstr_free(&ds_res);
if (ds_warn)
dynstr_free(ds_warn);
free_all_replace(); free_all_replace();
my_free(opt_pass); my_free(opt_pass);
free_defaults(default_argv); free_defaults(default_argv);
...@@ -7693,6 +7697,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) ...@@ -7693,6 +7697,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
die ("Cannot reap on a connection without pending send"); die ("Cannot reap on a connection without pending send");
init_dynamic_string(&ds_warnings, NULL, 0, 256); init_dynamic_string(&ds_warnings, NULL, 0, 256);
ds_warn= &ds_warnings;
/* /*
Evaluate query if this is an eval command Evaluate query if this is an eval command
*/ */
...@@ -7850,6 +7856,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) ...@@ -7850,6 +7856,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
ds, &ds_warnings); ds, &ds_warnings);
dynstr_free(&ds_warnings); dynstr_free(&ds_warnings);
ds_warn= 0;
if (command->type == Q_EVAL || command->type == Q_SEND_EVAL) if (command->type == Q_EVAL || command->type == Q_SEND_EVAL)
dynstr_free(&eval_query); dynstr_free(&eval_query);
......
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