Skip to content

Commit

Permalink
Fixed issue #1 - Filehandle leak eventually crashed the emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
0xe1f committed May 26, 2013
1 parent 00c7900 commit da4f38e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,3 @@
CocoaMSX.xcodeproj/xcuserdata CocoaMSX.xcodeproj/xcuserdata
CocoaMSX.xcodeproj/project.xcworkspace CocoaMSX.xcodeproj/project.xcworkspace
.DS_Store
4 changes: 3 additions & 1 deletion Src/Board/Machine.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ Machine* machineCreate(const char* machineName)
return NULL; // Not compressed and no config.ini return NULL; // Not compressed and no config.ini
} }


fclose(file);

machine->zipFile = (char *)calloc(strlen(zipFile) + 1, sizeof(char)); machine->zipFile = (char *)calloc(strlen(zipFile) + 1, sizeof(char));
strcpy(machine->zipFile, zipFile); strcpy(machine->zipFile, zipFile);


Expand Down Expand Up @@ -641,7 +643,7 @@ int machineIsValid(const char* machineName, int checkRoms)
{ {
if (machine->isZipped) if (machine->isZipped)
{ {
#ifdef COCOAMSX #ifdef __APPLE__
int location = unzLocateFile(zippedMachine, int location = unzLocateFile(zippedMachine,
machine->slotInfo[i].inZipName, 2); machine->slotInfo[i].inZipName, 2);
#else #else
Expand Down
4 changes: 2 additions & 2 deletions Src/Utils/ziphelper.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void* _zipLoadFile(const char* zipName, const char* fileName, int* size, zlib_fi
return NULL; return NULL;
} }


#ifdef COCOAMSX #ifdef __APPLE__
// Most OS X installs are on a case-insensitive FS // Most OS X installs are on a case-insensitive FS
if (unzLocateFile(zip, name, 2) == UNZ_END_OF_LIST_OF_FILE) { if (unzLocateFile(zip, name, 2) == UNZ_END_OF_LIST_OF_FILE) {
#else #else
Expand Down Expand Up @@ -470,7 +470,7 @@ int zipFileExists(const char* zipName, const char* fileName)
return 0; return 0;
} }


#ifdef COCOAMSX #ifdef __APPLE__
// Most OS X installs are on a case-insensitive FS // Most OS X installs are on a case-insensitive FS
if (unzLocateFile(zip, name, 2) == UNZ_END_OF_LIST_OF_FILE) { if (unzLocateFile(zip, name, 2) == UNZ_END_OF_LIST_OF_FILE) {
#else #else
Expand Down

0 comments on commit da4f38e

Please sign in to comment.