• Marko Mäkelä's avatar
    Fix USE_AFTER_FREE (CWE-416) · 10e01b56
    Marko Mäkelä authored
    A static analysis tool suggested that in the function
    row_merge_read_clustered_index(), ut_free(nonnull) could
    be invoked twice for nonnull!=NULL. While a manual review
    of the code disproved this, it should not hurt to clean up
    the code so that the static analysis tool will not complain.
    
    index_tuple_info_t::insert(), row_mtuple_cmp(): Remove the
    parameter mtr_committed, which duplicated !mtr->is_active().
    
    row_merge_read_clustered_index(): Initialize row_heap = NULL.
    Remove a duplicated call mem_heap_empty(row_heap) that was
    inadvertently added in commit cb1e76e4.
    
    Replace a "goto func_exit" with "break", to get consistent error
    handling for both failures to create or write a temporary file.
    
    end_of_index: Assign row_heap=NULL and nonnull=NULL to prevent
    double freeing.
    
    func_exit: Check for row_heap!=NULL before invoking mem_heap_free().
    
    Closes #959
    10e01b56
row0merge.cc 135 KB