mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-25925 Warning: Memory not freed: 32 on INSERT DELAYED
Also fixes MDEV-24467 Memory not freed after failed INSERT DELAYED Description: In case of an error (e.g. data truncation) during mysql_insert() handling an INSERT DELAYED, the data type specific data in fields (e.g. Field_blob::value) is not taken over by the delayed writer thread. All fields in table_list->table are freed by free_root() immediately after mysql_insert(). To avoid a memory leak, we need to free the specific data before exiting mysql_insert() on error.
This commit is contained in:
@ -1257,7 +1257,18 @@ values_loop_end:
|
||||
abort:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (lock_type == TL_WRITE_DELAYED)
|
||||
{
|
||||
end_delayed_insert(thd);
|
||||
/*
|
||||
In case of an error (e.g. data truncation), the data type specific data
|
||||
in fields (e.g. Field_blob::value) was not taken over
|
||||
by the delayed writer thread. All fields in table_list->table
|
||||
will be freed by free_root() soon. We need to free the specific
|
||||
data before free_root() to avoid a memory leak.
|
||||
*/
|
||||
for (Field **ptr= table_list->table->field ; *ptr ; ptr++)
|
||||
(*ptr)->free();
|
||||
}
|
||||
#endif
|
||||
if (table != NULL)
|
||||
table->file->ha_release_auto_increment();
|
||||
|
Reference in New Issue
Block a user