← Back to team overview

maria-developers team mailing list archive

Re: bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2686)

 

Hi, knielsen!

On Mar 18, knielsen@xxxxxxxxxxxxxxx wrote:
> 
> #At lp:maria
> 
>  2686 knielsen@xxxxxxxxxxxxxxx	2009-03-18
>       Fix some Valgrind warnings.
> modified:
>   dbug/dbug.c
>   mysql-test/valgrind.supp
>   sql/mysqld.cc
>   sql/scheduler.cc
>   sql/sql_select.cc
> 
> === modified file 'dbug/dbug.c'
> --- a/dbug/dbug.c	2009-03-12 22:27:35 +0000
> +++ b/dbug/dbug.c	2009-03-18 14:08:05 +0000
> @@ -506,6 +506,7 @@ int DbugParse(CODE_STATE *cs, const char
>    rel= control[0] == '+' || control[0] == '-';
>    if ((!rel || (!stack->out_file && !stack->next)))
>    {
> +    FreeState(cs, stack, 0);

you may be freeing uuninitialized data here.
What are you trying to fix anyway ?

>      stack->flags= 0;
>      stack->delay= 0;
>      stack->maxdepth= 0;
> @@ -1648,10 +1649,12 @@ static void FreeState(CODE_STATE *cs, st
>      FreeList(state->processes);
>    if (!is_shared(state, p_functions))
>      FreeList(state->p_functions);
> -  if (!is_shared(state, out_file))
> +  if (!is_shared(state, out_file) &&
> +      state->out_file != stderr && state->out_file != stdout)
>      DBUGCloseFile(cs, state->out_file);
>    (void) fflush(cs->stack->out_file);
> -  if (state->prof_file)
> +  if (state->prof_file &&
> +      state->out_file != stderr && state->out_file != stdout)

typo. you obviously want s/out_file/prof_file/g

>      DBUGCloseFile(cs, state->prof_file);
>    if (free_state)
>      free((void*) state);
> 
Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@xxxxxxx>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring



Follow ups

References