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);
{ fileList = NULL;
free (fileList);
fileList = NULL;
}
ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt); ret = __Menu_RetrieveList(tmpPath, &fileList, &fileCnt);
if (ret < 0) { if (ret < 0) {

View File

@ -108,8 +108,7 @@ s32 Title_GetList(u64 **outbuf, u32 *outlen)
err: err:
/* Free memory */ /* Free memory */
if (titles) free(titles);
free(titles);
return ret; return ret;
} }
@ -144,8 +143,7 @@ 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,8 +178,7 @@ 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,8 +314,7 @@ 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,8 +239,7 @@ 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,16 +510,11 @@ err:
out: out:
/* Free memory */ /* Free memory */
if (header) free(header);
free(header); free(p_certs);
if (p_certs) free(p_crl);
free(p_certs); free(p_tik);
if (p_crl) free(p_tmd);
free(p_crl);
if (p_tik)
free(p_tik);
if (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;
} }