Only call socExit() if socInit() succeeded

This commit is contained in:
Michael Theall 2016-04-09 11:54:34 -05:00
parent 56b509e58e
commit c7cd0ec231

View File

@ -1567,6 +1567,7 @@ ftp_init(void)
#ifdef _3DS
soc_fail:
free(SOCU_buffer);
SOCU_buffer = NULL;
memalign_fail:
#ifdef ENABLE_LOGGING
@ -1577,7 +1578,6 @@ ftruncate_fail:
log_fail:
#endif
return -1;
#endif
}
@ -1601,10 +1601,14 @@ ftp_exit(void)
/* deinitialize SOC service */
console_render();
console_print(CYAN "Waiting for socExit()...\n" RESET);
ret = socExit();
if(ret != 0)
console_print(RED "socExit: 0x%08X\n" RESET, (unsigned int)ret);
free(SOCU_buffer);
if(SOCU_buffer != NULL)
{
ret = socExit();
if(ret != 0)
console_print(RED "socExit: 0x%08X\n" RESET, (unsigned int)ret);
free(SOCU_buffer);
}
#ifdef ENABLE_LOGGING
/* close log file */