Added some malloc() failure checks in CD-ROM detection code.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 05 Apr 2002 08:45:08 +0000
changeset 171 0d92d6358410
parent 170 d826bf2c38c8
child 172 ebad22720e88
Added some malloc() failure checks in CD-ROM detection code.
platform/unix.c
--- a/platform/unix.c	Fri Apr 05 08:42:02 2002 +0000
+++ b/platform/unix.c	Fri Apr 05 08:45:08 2002 +0000
@@ -82,6 +82,8 @@
     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 @@
     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);