From 42a386c247b58bd96c5d9e2d8fc7ab537557ab61 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 5 Apr 2002 08:45:08 +0000 Subject: [PATCH] Added some malloc() failure checks in CD-ROM detection code. --- platform/unix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/unix.c b/platform/unix.c index e61c3932..fd0a745c 100644 --- a/platform/unix.c +++ b/platform/unix.c @@ -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 ) { @@ -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);