ReinhardPrix / FreedroidClassic

The original Freedroid, a free & open-source clone of the C64 classic 'Paradroid'.
GNU General Public License v2.0
39 stars 6 forks source link

memory leaks #7

Closed matthiaskrgr closed 6 years ago

matthiaskrgr commented 6 years ago

I was playing ingame and with the level editor a bit, these memory leaks occurred:

=================================================================
==11742==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 32120 byte(s) in 365 object(s) allocated from:
    #0 0x312083 in __interceptor_malloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:88:3
    #1 0x7f7241fbd27c in SDL_CreateRGBSurface (/usr/lib/libSDL-1.2.so.0+0x2a27c)
Direct leak of 17894 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x41fb99 in ReadAndMallocAndTerminateFile /tmp/FreedroidClassic/src/misc.c:477:24
    #3 0x3fe3c5 in GetCrew /tmp/FreedroidClassic/src/map.c:1111:27
    #4 0x3ba65c in InitNewMission /tmp/FreedroidClassic/src/init.c:735:7
    #5 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #6 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 17015 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x41fb99 in ReadAndMallocAndTerminateFile /tmp/FreedroidClassic/src/misc.c:477:24
    #3 0x3fb92f in GetLiftConnections /tmp/FreedroidClassic/src/map.c:986:10
    #4 0x3ba4b5 in InitNewMission /tmp/FreedroidClassic/src/init.c:707:7
    #5 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #6 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 901 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x3bc7e6 in Title /tmp/FreedroidClassic/src/init.c:1008:30
    #3 0x3bb556 in InitNewMission /tmp/FreedroidClassic/src/init.c:810:3
    #4 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #5 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 160 byte(s) in 5 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x3f2525 in LevelToStruct /tmp/FreedroidClassic/src/map.c:606:27
    #3 0x3f0fbd in LoadShip /tmp/FreedroidClassic/src/map.c:287:30
    #4 0x3ba45c in InitNewMission /tmp/FreedroidClassic/src/init.c:696:8
    #5 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #6 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 152 byte(s) in 2 object(s) allocated from:
    #0 0x312482 in __interceptor_realloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:107:3
    #1 0x7f723e915b5c  (/usr/lib/libX11.so.6+0x54b5c)
Direct leak of 120 byte(s) in 5 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x412316 in LevelEditMenu /tmp/FreedroidClassic/src/menu.c:985:28
    #3 0x3e6532 in LevelEditor /tmp/FreedroidClassic/src/level_editor.c:475:9
    #4 0x408b1e in handle_LevelEditor /tmp/FreedroidClassic/src/menu.c:434:5
    #5 0x40d662 in ShowMenu /tmp/FreedroidClassic/src/menu.c:673:17
    #6 0x40c512 in showMainMenu /tmp/FreedroidClassic/src/menu.c:506:10
    #7 0x3cac49 in ReactToSpecialKeys /tmp/FreedroidClassic/src/input.c:360:5
    #8 0x3eae85 in main /tmp/FreedroidClassic/src/main.c:123:4
    #9 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 60 byte(s) in 3 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x463a83 in GetString /tmp/FreedroidClassic/src/text.c:490:15
    #3 0x410540 in LevelEditMenu /tmp/FreedroidClassic/src/menu.c:900:27
    #4 0x3e6532 in LevelEditor /tmp/FreedroidClassic/src/level_editor.c:475:9
    #5 0x408b1e in handle_LevelEditor /tmp/FreedroidClassic/src/menu.c:434:5
    #6 0x40d662 in ShowMenu /tmp/FreedroidClassic/src/menu.c:673:17
    #7 0x40c512 in showMainMenu /tmp/FreedroidClassic/src/menu.c:506:10
    #8 0x3cac49 in ReactToSpecialKeys /tmp/FreedroidClassic/src/input.c:360:5
    #9 0x3eae85 in main /tmp/FreedroidClassic/src/main.c:123:4
    #10 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 41 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x41f458 in ReadAndMallocStringFromData /tmp/FreedroidClassic/src/misc.c:383:22
    #3 0x3f1fb1 in LevelToStruct /tmp/FreedroidClassic/src/map.c:583:36
    #4 0x3f0fbd in LoadShip /tmp/FreedroidClassic/src/map.c:287:30
    #5 0x3ba45c in InitNewMission /tmp/FreedroidClassic/src/init.c:696:8
    #6 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #7 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 25 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x463a83 in GetString /tmp/FreedroidClassic/src/text.c:490:15
    #3 0x4108e9 in LevelEditMenu /tmp/FreedroidClassic/src/menu.c:912:36
    #4 0x3e6532 in LevelEditor /tmp/FreedroidClassic/src/level_editor.c:475:9
    #5 0x408b1e in handle_LevelEditor /tmp/FreedroidClassic/src/menu.c:434:5
    #6 0x40d662 in ShowMenu /tmp/FreedroidClassic/src/menu.c:673:17
    #7 0x40c512 in showMainMenu /tmp/FreedroidClassic/src/menu.c:506:10
    #8 0x3cac49 in ReactToSpecialKeys /tmp/FreedroidClassic/src/input.c:360:5
    #9 0x3eae85 in main /tmp/FreedroidClassic/src/main.c:123:4
    #10 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 20 byte(s) in 2 object(s) allocated from:
    #0 0x2fd6ed in __interceptor___strdup /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:423:3
    #1 0x7f723e92de56  (/usr/lib/libX11.so.6+0x6ce56)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x41f458 in ReadAndMallocStringFromData /tmp/FreedroidClassic/src/misc.c:383:22
    #3 0x3f1ebd in LevelToStruct /tmp/FreedroidClassic/src/map.c:582:37
    #4 0x3f0fbd in LoadShip /tmp/FreedroidClassic/src/map.c:287:30
    #5 0x3ba45c in InitNewMission /tmp/FreedroidClassic/src/init.c:696:8
    #6 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #7 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x31226a in __interceptor_calloc /home/matthias/LLVM/LLVM6/stage_2/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:97:3
    #1 0x41d836 in MyMalloc /tmp/FreedroidClassic/src/misc.c:1073:15
    #2 0x41f458 in ReadAndMallocStringFromData /tmp/FreedroidClassic/src/misc.c:383:22
    #3 0x3f1dcb in LevelToStruct /tmp/FreedroidClassic/src/map.c:581:26
    #4 0x3f0fbd in LoadShip /tmp/FreedroidClassic/src/map.c:287:30
    #5 0x3ba45c in InitNewMission /tmp/FreedroidClassic/src/init.c:696:8
    #6 0x3e8d4f in main /tmp/FreedroidClassic/src/main.c:86:7
    #7 0x7f7241c22222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
ReinhardPrix commented 6 years ago

argh, the level editor ... I'll see what I can do.

ReinhardPrix commented 6 years ago

Seems to be fixed by merged pull request #12