Merge pull request #351 from SindenLightgun/master
[pcsx_rearmed.git] / libpcsxcore / ppf.c
index 0d80107..f6ccfca 100644 (file)
@@ -183,7 +183,7 @@ void BuildPPFCache() {
        char                    method, undo = 0, blockcheck = 0;
        int                             dizlen, dizyn;
        unsigned char   ppfmem[512];
-       char                    szPPF[MAXPATHLEN];
+       char                    szPPF[MAXPATHLEN * 2];
        int                             count, seekpos, pos;
        u32                             anz; // use 32-bit to avoid stupid overflows
        s32                             ladr, off, anx;
@@ -347,8 +347,10 @@ int LoadSBI(const char *fname, int sector_count) {
                return -1;
 
        sbi_sectors = calloc(1, sector_count / 8);
-       if (sbi_sectors == NULL)
+       if (sbi_sectors == NULL) {
+               fclose(sbihandle);
                return -1;
+       }
 
        // 4-byte SBI header
        fread(buffer, 1, 4, sbihandle);