Revision: 48416
          http://brlcad.svn.sourceforge.net/brlcad/?rev=48416&view=rev
Author:   starseeker
Date:     2012-01-11 18:00:42 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Check if file is NULL up front.  CID 272

Modified Paths:
--------------
    brlcad/trunk/src/libfb/if_mem.c

Modified: brlcad/trunk/src/libfb/if_mem.c
===================================================================
--- brlcad/trunk/src/libfb/if_mem.c     2012-01-11 17:56:19 UTC (rev 48415)
+++ brlcad/trunk/src/libfb/if_mem.c     2012-01-11 18:00:42 UTC (rev 48416)
@@ -79,6 +79,10 @@
 
     FB_CK_FBIO(ifp);
 
+    /* This function doesn't look like it will work if file
+     * is NULL - stop before we start, if that's the case.*/
+    if (file == NULL) return -1;
+
     /*
      * First, attempt to determine operating mode for this open,
      * based upon the "unit number" or flags.
@@ -87,7 +91,6 @@
      */
     mode = 0;
 
-    if (file != NULL) {
        char modebuf[80];
        char *mp;
        int alpha;
@@ -123,7 +126,6 @@
            if (!alpha)
                mode = atoi(modebuf);
        }
-    }
 
     /* build a local static info struct */
     if ((MIL(ifp) = (char *)calloc(1, sizeof(struct meminfo))) == NULL) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to