missing textures: fix double free
This commit is contained in:
parent
3052bb693a
commit
87ae1a7312
@ -68,12 +68,11 @@ static SDL_Surface *gen_missing_texture_surface(void) {
|
||||
}
|
||||
|
||||
/* same data is reused after being allocated/generated once */
|
||||
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(missing_texture_data, 64, 64,
|
||||
SDL_Surface *missing_texture_surface = SDL_CreateRGBSurfaceFrom(missing_texture_data, 64, 64,
|
||||
3 * 8,
|
||||
64 * 3,
|
||||
rmask, gmask, bmask, 0);
|
||||
|
||||
return surface;
|
||||
return missing_texture_surface;
|
||||
}
|
||||
|
||||
|
||||
@ -328,6 +327,7 @@ void textures_cache_deinit(TextureCache *cache) {
|
||||
|
||||
/* free cache hashes */
|
||||
for (size_t i = 0; i < shlenu(cache->hash); ++i) {
|
||||
if (cache->hash[i].value.data->pixels != missing_texture_data)
|
||||
stbi_image_free(cache->hash[i].value.data->pixels);
|
||||
SDL_FreeSurface(cache->hash[i].value.data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user