Set the global variable to NULL on free in driver.c and runloop.c

This commit is contained in:
Higor Eurípedes 2015-05-19 13:58:22 -03:00
parent dfd6d464a8
commit feef97f0df
2 changed files with 9 additions and 11 deletions

View File

@ -30,14 +30,14 @@
#include "config.h"
#endif
static driver_t *g_driver;
static driver_t *g_driver = NULL;
void driver_free(void)
{
driver_t *driver = driver_get_ptr();
if (g_driver)
free(g_driver);
if (driver)
free(driver);
g_driver = NULL;
}
static driver_t *driver_new(void)

View File

@ -35,9 +35,8 @@
#include "netplay.h"
#endif
static struct runloop *g_runloop;
static struct global *g_extern;
static struct runloop *g_runloop = NULL;
static struct global *g_extern = NULL;
/**
* check_pause:
@ -941,12 +940,11 @@ runloop_t *rarch_main_get_ptr(void)
void rarch_main_state_free(void)
{
runloop_t *runloop = rarch_main_get_ptr();
if (!runloop)
if (!g_runloop)
return;
free(runloop);
free(g_runloop);
g_runloop = NULL;
}
void rarch_main_global_free(void)