Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added some malloc() failure checks in CD-ROM detection code.
  • Loading branch information
icculus committed Apr 5, 2002
1 parent f4d0842 commit 42a386c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions platform/unix.c
Expand Up @@ -82,6 +82,8 @@ char **__PHYSFS_platformDetectAvailableCDs(void)
int mounts;
int ii;

BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);

mounts = getmntinfo( &mntbufp, MNT_WAIT );

for ( ii=0; ii < mounts; ++ii ) {
Expand Down Expand Up @@ -125,6 +127,8 @@ char **__PHYSFS_platformDetectAvailableCDs(void)
FILE *mounts = NULL;
struct mntent *ent = NULL;

BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);

*retval = NULL;
mounts = setmntent("/etc/mtab", "r");
BAIL_IF_MACRO(mounts == NULL, ERR_IO_ERROR, retval);
Expand Down

0 comments on commit 42a386c

Please sign in to comment.