r367 - trunk

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 29 22:08:29 EDT 2007


Author: icculus
Date: 2007-09-29 22:08:29 -0400 (Sat, 29 Sep 2007)
New Revision: 367

Modified:
   trunk/fileio.c
Log:
Don't dereference a NULL pointer right before we check if it's actually NULL.
 Thanks to Gerry JJ for the catch.


Modified: trunk/fileio.c
===================================================================
--- trunk/fileio.c	2007-09-30 01:44:31 UTC (rev 366)
+++ trunk/fileio.c	2007-09-30 02:08:29 UTC (rev 367)
@@ -348,13 +348,15 @@
     char *fullpath = NULL;
     char *dent = NULL;  // "dent" == "directory entry"
     MojoArchiveDirInstance *inst = (MojoArchiveDirInstance *) ar->opaque;
-    const char *basepath = inst->dirs->basepath;
+    const char *basepath;
 
     MojoArchive_resetEntry(&ar->prevEnum);
 
     if (inst->dirs == NULL)
         return NULL;
 
+    basepath = inst->dirs->basepath;
+
     // if readdir fails, it's end of dir (!!! FIXME: what about i/o failures?)
     dent = MojoPlatform_readdir(inst->dirs->dir);
     if (dent == NULL)  // end of dir?




More information about the mojosetup-commits mailing list