Fix a potential memory leak in menu/rmenu_xui.cpp in function rgui_init().

This commit is contained in:
Lioncash 2013-10-17 14:16:07 -04:00
parent e6917787ee
commit fb4dd42edf

View File

@ -1256,6 +1256,11 @@ static void* rgui_init (void)
HRESULT hr;
rgui_handle_t *rgui = (rgui_handle_t*)calloc(1, sizeof(*rgui));
if (rgui == NULL)
{
RARCH_LOG("Could not allocate RGUI handle.\n");
return NULL;
}
xdk_d3d_video_t *device_ptr = (xdk_d3d_video_t*)driver.video_data;
@ -1281,6 +1286,7 @@ static void* rgui_init (void)
if (hr != S_OK)
{
RARCH_ERR("Failed initializing XUI application.\n");
free(rgui);
return NULL;
}
@ -1294,6 +1300,7 @@ static void* rgui_init (void)
if (hr != S_OK)
{
RARCH_ERR("Failed to register default typeface.\n");
free(rgui);
return NULL;
}
@ -1301,6 +1308,7 @@ static void* rgui_init (void)
if (hr != S_OK)
{
RARCH_ERR("Failed to load skin.\n");
free(rgui);
return NULL;
}
@ -1308,6 +1316,7 @@ static void* rgui_init (void)
if (hr != S_OK)
{
RARCH_ERR("Failed to create scene 'rarch_main.xur'.\n");
free(rgui);
return NULL;
}
@ -1316,6 +1325,7 @@ static void* rgui_init (void)
if (hr != S_OK)
{
RARCH_ERR("XuiSceneNavigateFirst failed.\n");
free(rgui);
return NULL;
}