sp_lvl: fix memory leak on lspo_region
If tutorial is entered, we get following leak on exit:
=================================================================
==81358==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 96 byte(s) in 3 object(s) allocated from:
#0 0x7f6996edefdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x5601c255bcbb in alloc /home/miku/src/NetHack/src/alloc.c:71
Indirect leak of 5064 byte(s) in 3 object(s) allocated from:
#0 0x7f6996edefdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x5601c255be1e in alloc /home/miku/src/NetHack/src/alloc.c:71
#2 0x5601c255be1e in dupstr /home/miku/src/NetHack/src/alloc.c:236
SUMMARY: AddressSanitizer: 5160 byte(s) leaked in 6 allocation(s).
Fix this by freeing the cloned selection before returning.
This commit is contained in:
committed by
Pasi Kallinen
parent
a2aa4edd51
commit
e6c4838161
@@ -6191,6 +6191,8 @@ lspo_region(lua_State *L)
|
||||
selection_do_grow(sel, W_ANY);
|
||||
selection_iterate(sel, sel_set_lit, (genericptr_t) &rlit);
|
||||
|
||||
selection_free(sel, TRUE);
|
||||
|
||||
/* TODO: skip the rest of this function? */
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user