Index: row/row0ins.c =================================================================== --- row/row0ins.c (revision 340) +++ row/row0ins.c (working copy) @@ -1874,7 +1874,6 @@ row_ins_duplicate_error_in_clust( err = DB_DUPLICATE_KEY; goto func_exit; } - mem_heap_free(heap); } ut_a(!(cursor->index->type & DICT_CLUSTERED)); @@ -1883,6 +1882,9 @@ row_ins_duplicate_error_in_clust( err = DB_SUCCESS; func_exit: + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } return(err); #else /* UNIV_HOTBACKUP */ /* This function depends on MySQL code that is not included in