Freeing NULL is fine

This commit is contained in:
Peter0x44 2022-04-19 12:09:14 +01:00
parent c52449fd4a
commit ac7ce067d6
No known key found for this signature in database
GPG Key ID: A8DEAD1A4BB82440
3 changed files with 13 additions and 27 deletions

View File

@ -796,11 +796,8 @@ void Menu_WadList(void)
/* Retrieve filelist */ /* Retrieve filelist */
getList: getList:
if (fileList)
{
free (fileList); free (fileList);
fileList = NULL; fileList = NULL;
}
ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt); ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt);
if (ret < 0) { if (ret < 0) {

View File

@ -108,7 +108,6 @@ s32 Title_GetList(u64 **outbuf, u32 *outlen)
err: err:
/* Free memory */ /* Free memory */
if (titles)
free(titles); free(titles);
return ret; return ret;
@ -144,7 +143,6 @@ s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen)
err: err:
/* Free memory */ /* Free memory */
if (views)
free(views); free(views);
return ret; return ret;
@ -180,7 +178,6 @@ s32 Title_GetTMD(u64 tid, signed_blob **outbuf, u32 *outlen)
err: err:
/* Free memory */ /* Free memory */
if (p_tmd)
free(p_tmd); free(p_tmd);
return ret; return ret;
@ -317,7 +314,6 @@ s32 Title_GetIOSVersions(u8 **outbuf, u32 *outlen)
out: out:
/* Free memory */ /* Free memory */
if (list)
free(list); free(list);
return ret; return ret;

View File

@ -239,7 +239,6 @@ s32 __Wad_GetTitleID(FILE *fp, wadHeader *header, u64 *tid)
out: out:
/* Free memory */ /* Free memory */
if (p_tik)
free(p_tik); free(p_tik);
return ret; return ret;
@ -511,15 +510,10 @@ err:
out: out:
/* Free memory */ /* Free memory */
if (header)
free(header); free(header);
if (p_certs)
free(p_certs); free(p_certs);
if (p_crl)
free(p_crl); free(p_crl);
if (p_tik)
free(p_tik); free(p_tik);
if (p_tmd)
free(p_tmd); free(p_tmd);
return ret; return ret;
@ -671,7 +665,6 @@ s32 Wad_Uninstall(FILE *fp)
out: out:
/* Free memory */ /* Free memory */
if (header)
free(header); free(header);
return ret; return ret;
} }