Skip to content
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

Fix double-free crash #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int audio_2p_mode = 0;
bool already_checked_options = false;
bool libretro_supports_persistent_buffer = false;
bool libretro_supports_bitmasks = false;
struct retro_system_av_info *my_av_info = (retro_system_av_info*)malloc(sizeof(*my_av_info));
struct retro_system_av_info *my_av_info;

void retro_get_system_info(struct retro_system_info *info)
{
Expand Down Expand Up @@ -128,12 +128,15 @@ void retro_init(void)

environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);

my_av_info = (retro_system_av_info*)malloc(sizeof(*my_av_info));

if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
libretro_supports_bitmasks = true;
}

void retro_deinit(void)
{
free(my_av_info);
libretro_supports_bitmasks = false;
}

Expand Down Expand Up @@ -405,7 +408,6 @@ void retro_unload_game(void)
render[i] = NULL;
}
}
free(my_av_info);
libretro_supports_persistent_buffer = false;
}

Expand Down
Loading