fix heap-use-after-free
Merge pull request #2645 from cremno/mrdb-fix-heap-use-after-free

mrdb: fix heap-use-after-free