-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cute_tiled animations not freed #271
Comments
Thanks for catching this! |
My apologies for not being super on-top of this. It's a little time consuming for me to make my own test tiled files, as I no longer use Tiled for my own game. Though, I like Tiled and want to continue supporting cute_tiled :) Just need a JSON file to repro the bug with, and I'll have it fixed shortly thereafter! |
When using an embedded tileset there's no leak, only when I use an external tileset does valgrind give me a leak here: Direct leak of 768 byte(s) in 3 object(s) allocated from:
#0 0x7f90985047ef in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7f9097d19791 in cute_tiled_read_animation_frames_internal ../../lib/cute_headers/cute_tiled.h:2147 The way I'm loading/destroying my files is as such: // Load
cute_tiled_map_t *map = cute_tiled_load_map_from_file("units32.json", NULL);
cute_tiled_tileset_t *tileset = map->tilesets;
cute_tiled_tileset_t *external = NULL;
if (tileset && tileset->source.ptr) { // if it has a source it means it's external
external = cute_tiled_load_external_tileset(tileset->source.ptr, NULL);
}
// Destroy
if (external) {
cute_tiled_free_external_tileset(external);
}
cute_tiled_free_map(map); Here are all the files needed to reproduce: If I run the ==16341==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 768 byte(s) in 3 object(s) allocated from:
#0 0x7f26aad037ef in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x559b65d72e85 in cute_tiled_read_animation_frames_internal (/home/aganm/Projects/test/a.out+0xde85)
#2 0x559b65d73a4f in cute_tiled_read_tile_descriptor (/home/aganm/Projects/test/a.out+0xea4f)
#3 0x559b65d74e47 in cute_tiled_tileset (/home/aganm/Projects/test/a.out+0xfe47)
#4 0x559b65d77c77 in cute_tiled_load_external_tileset_from_memory (/home/aganm/Projects/test/a.out+0x12c77)
#5 0x559b65d77bda in cute_tiled_load_external_tileset (/home/aganm/Projects/test/a.out+0x12bda)
#6 0x559b65d77eb3 in main (/home/aganm/Projects/test/a.out+0x12eb3)
#7 0x7f26aaab6d09 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: 768 byte(s) leaked in 3 allocation(s). |
I don't believe this is an issue. The frames are read to the tile descriptor's
In
|
I found a memory leak happening here
cute_headers/cute_tiled.h
Line 2147 in 3510be7
I think the respective free calls are missing
The text was updated successfully, but these errors were encountered: