Skip to content

Commit

Permalink
Fixed dereference of free()'d memory.
Browse files Browse the repository at this point in the history
Thanks to Evgeny Podjachev for the fix!
  • Loading branch information
icculus committed Mar 13, 2012
1 parent c57bd94 commit a42ada1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/archiver_dir.c
Expand Up @@ -64,20 +64,21 @@ static PHYSFS_Io *doOpen(dvoid *opaque, const char *name,
if (fileExists == NULL)
fileExists = &existtmp;

*fileExists = 0;

BAIL_IF_MACRO(f == NULL, NULL, NULL);

io = __PHYSFS_createNativeIo(f, mode);
allocator.Free(f);
if (io == NULL)
{
PHYSFS_Stat statbuf; /* !!! FIXME: this changes the error message. */
__PHYSFS_platformStat(f, fileExists, &statbuf);
return NULL;
} /* if */
else
{
*fileExists = 1;
} /* else */

allocator.Free(f);

*fileExists = 1;
return io;
} /* doOpen */

Expand Down

0 comments on commit a42ada1

Please sign in to comment.