Fixed memory leaks.
parent
4dacefe989
commit
a49cd40952
|
@ -115,6 +115,10 @@ int corlett_decode(uint8 *input, uint32 input_len, uint8 **output, uint64 *size,
|
|||
|
||||
// Decompress data if any
|
||||
decomp_dat = malloc(DECOMP_MAX_SIZE);
|
||||
if (NULL == decomp_dat) {
|
||||
return AO_FAIL;
|
||||
}
|
||||
|
||||
decomp_length = DECOMP_MAX_SIZE;
|
||||
if (uncompress(decomp_dat, &decomp_length, (unsigned char *)&buf[4+(res_area/4)], comp_length) != Z_OK)
|
||||
{
|
||||
|
|
|
@ -254,11 +254,12 @@ int32 psf_start(uint8 *buffer, uint32 length)
|
|||
|
||||
// Dispose the corlett structure for the lib - we don't use it
|
||||
free(lib);
|
||||
free(alib_decoded);
|
||||
}
|
||||
}
|
||||
|
||||
free(file);
|
||||
// free(lib_decoded);
|
||||
free(lib_decoded);
|
||||
|
||||
// Finally, set psfby tag
|
||||
strcpy(psfby, "n/a");
|
||||
|
|
|
@ -507,6 +507,8 @@ int32 psf2_start(uint8 *buffer, uint32 length)
|
|||
return AO_FAIL;
|
||||
}
|
||||
|
||||
free(lib_raw_file);
|
||||
|
||||
#if DEBUG_LOADER
|
||||
printf("Lib FS section: size %x bytes\n", lib->res_size);
|
||||
#endif
|
||||
|
|
|
@ -209,14 +209,12 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
|
|||
{
|
||||
NSLog(@"ERROR: File is unknown, signature bytes are %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]);
|
||||
|
||||
free(buffer);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
if ((*types[type].start)(buffer, size) != AO_SUCCESS)
|
||||
{
|
||||
free(buffer);
|
||||
NSLog(@"ERROR: Engine rejected file!\n");
|
||||
|
||||
return NO;
|
||||
|
@ -235,7 +233,9 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
|
|||
[globalLock lock];
|
||||
|
||||
BOOL ret = [self openUnderLock:source];
|
||||
|
||||
if (!ret) {
|
||||
[self close];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,10 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
|
|||
- (void)closeUnderLock
|
||||
{
|
||||
(*types[type ].stop)();
|
||||
if (NULL != buffer) {
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
[currentSource release];
|
||||
currentSource = nil;
|
||||
|
@ -307,6 +310,7 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
|
|||
NSDictionary *metadata = [decoder metadata];
|
||||
|
||||
[decoder closeUnderLock];
|
||||
[decoder release];
|
||||
|
||||
[globalLock unlock];
|
||||
|
||||
|
|
Loading…
Reference in New Issue