Commit 46f712c7 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15114: Fix memory leaks

When innobase_allocate_row_for_vcol() returns true (for failure),
it may already have invoked mem_heap_create(). However, some callers
would fail to invoke mem_heap_free().
parent b572814b
...@@ -966,11 +966,11 @@ row_ins_foreign_fill_virtual( ...@@ -966,11 +966,11 @@ row_ins_foreign_fill_virtual(
if (innobase_allocate_row_for_vcol(thd, index, &v_heap, if (innobase_allocate_row_for_vcol(thd, index, &v_heap,
&mysql_table, &mysql_table,
&record, &vcol_storage)) &record, &vcol_storage)) {
{ if (v_heap) mem_heap_free(v_heap);
*err = DB_OUT_OF_MEMORY; *err = DB_OUT_OF_MEMORY;
goto func_exit; goto func_exit;
} }
for (ulint i = 0; i < n_v_fld; i++) { for (ulint i = 0; i < n_v_fld; i++) {
......
...@@ -1162,6 +1162,7 @@ row_upd_build_difference_binary( ...@@ -1162,6 +1162,7 @@ row_upd_build_difference_binary(
&v_heap, heap, NULL, thd, mysql_table, record, &v_heap, heap, NULL, thd, mysql_table, record,
NULL, NULL, NULL); NULL, NULL, NULL);
if (vfield == NULL) { if (vfield == NULL) {
if (v_heap) mem_heap_free(v_heap);
*error = DB_COMPUTE_VALUE_FAILED; *error = DB_COMPUTE_VALUE_FAILED;
return(NULL); return(NULL);
} }
......
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