• Sergey Vojtovich's avatar
    BUG#11763882 - 56652: VALGRIND WARNINGS FOR MEMORY LEAK IN · cdb19df7
    Sergey Vojtovich authored
                          ALTER TABLE AND/OR PLUGIN/SEMISYNC
    
    If a plugin was uninstalled, thread local values for plugin
    variables of string type with PLUGIN_VAR_MEMALLOC flag were
    not freed.
    
    With this patch these variables are freed when thread is
    done (like all other variables).
    
    sql/sql_class.h:
      Added variable which stores memory hunks allocated
      for PLUGIN_VAR_MEMALLOC values.
    sql/sql_plugin.cc:
      Normally all memory allocated for dynamic variables values must
      be freed by cleanup_variables().
      
      But if a plugin was uninstalled, descriptors of it's system
      variables are lost. Still some memory may be occupied for thread
      local values. It is ok for most kinds of variables, as they're
      stored on dynamic_variables_ptr and freed when thread is done.
      
      Values for PLUGIN_VAR_MEMALLOC variables are stored separately.
      These lost values are handled by plugin_var_memalloc_free().
    cdb19df7
sql_plugin.cc 108 KB