* memory snapshots fix use after free on flatview copy
When restoring a snapshot with memory the flatview must be restored
before the memory reagions are filtered. Because the
AddressSpaceDispatcher also has pointer to the MemoryRegions and on copy
they need to be cleared. The memory_filter_subregions function frees
MemoryRegions which are not used at the time of the snapshot.
* fix some memleaks in tests
These tests has forgott to call uc_close(uc), which lead to memory
leaks. Found by the LeakSanitizer.
* memory snapshots correct clean up container memory regions
* Fix further stackoverflow in tests
---------
Co-authored-by: mio <mio@lazym.io>