• Monty's avatar
    Fixed memory leak introduces by a fix for MDEV-29932 · 08e6431c
    Monty authored
    The leaks are all 40 bytes and happens in this call stack when running
    mtr vcol.vcol_syntax:
    
    alloc_root()
    ...
    Virtual_column_info::fix_and_check_exp()
    ...
    Delayed_insert::get_local_table()
    
    The problem was that one copied a MEM_ROOT from THD to a TABLE without
    taking into account that new blocks would be allocated through the
    TABLE memroot (and would thus be leaked).
    In general, one should NEVER copy MEM_ROOT from one object to another
    without clearing the copied memroot!
    
    Fixed by, at end of get_local_table(), copy all new allocated objects
    to client_thd->mem_root.
    
    Other things:
    - Removed references to MEM_ROOT::total_alloc that was wrongly left
      after a previous commit
    08e6431c
my_alloc.c 14.7 KB