Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
Potator
Commits
3c6990a8
Commit
3c6990a8
authored
Mar 11, 2021
by
jdgleaver
Browse files
libretro: Fix memory leak (ensure copy of ROM data is free()'d in retro_unload_game())
parent
b5e5ba02
Pipeline
#16844
passed with stages
in 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
platform/libretro/libretro.c
View file @
3c6990a8
...
...
@@ -44,6 +44,7 @@ static int ghosting_frames = 0;
static
uint16
*
video_buffer
=
NULL
;
static
uint8
*
audio_samples_buffer
=
NULL
;
static
int16_t
*
audio_out_buffer
=
NULL
;
uint8
*
rom_data
=
NULL
;
struct
sv_color_scheme
{
...
...
@@ -256,7 +257,6 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
bool
retro_load_game
(
const
struct
retro_game_info
*
info
)
{
enum
retro_pixel_format
fmt
=
RETRO_PIXEL_FORMAT_RGB565
;
uint8
*
rom_data
=
NULL
;
bool
success
=
false
;
struct
retro_input_descriptor
desc
[]
=
{
...
...
@@ -286,9 +286,7 @@ bool retro_load_game(const struct retro_game_info *info)
return
false
;
}
/* Potator requires a *copy* of the ROM data...
* > Note: the buffer will be free()'d inside
* supervision_load() */
/* Potator requires a *copy* of the ROM data */
rom_data
=
(
uint8
*
)
malloc
(
info
->
size
);
if
(
!
rom_data
)
...
...
@@ -329,6 +327,12 @@ bool retro_load_game_special(unsigned game_type, const struct retro_game_info *i
void
retro_unload_game
(
void
)
{
supervision_done
();
if
(
rom_data
)
{
free
(
rom_data
);
rom_data
=
NULL
;
}
}
unsigned
retro_get_region
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment