Fix possible null ptr dereference
authorcharles <charles>
Wed, 1 Mar 2006 08:18:09 +0000 (08:18 +0000)
committercharles <charles>
Wed, 1 Mar 2006 08:18:09 +0000 (08:18 +0000)
direct/yaffsfs.c

index 914e714b412ec2ef587b6142b779a6dc99c8f09c..0638c80b4af0423af184291efa4e43ff68c51e34 100644 (file)
@@ -25,7 +25,7 @@
 #endif
 
 
 #endif
 
 
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.8 2006-02-08 22:38:24 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.9 2006-03-01 08:18:09 charles Exp $";
 
 // configurationList is the list of devices that are supported
 static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
 
 // configurationList is the list of devices that are supported
 static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
@@ -999,13 +999,14 @@ int yaffs_fchmod(int fd, mode_t mode)
 int yaffs_mkdir(const char *path, mode_t mode)
 {
        yaffs_Object *parent = NULL;
 int yaffs_mkdir(const char *path, mode_t mode)
 {
        yaffs_Object *parent = NULL;
-       yaffs_Object *dir;
+       yaffs_Object *dir = NULL;
        char *name;
        int retVal= -1;
        
        yaffsfs_Lock();
        parent = yaffsfs_FindDirectory(NULL,path,&name,0);
        char *name;
        int retVal= -1;
        
        yaffsfs_Lock();
        parent = yaffsfs_FindDirectory(NULL,path,&name,0);
-       dir = yaffs_MknodDirectory(parent,name,mode,0,0);
+       if(parent)
+               dir = yaffs_MknodDirectory(parent,name,mode,0,0);
        if(dir)
        {
                retVal = 0;
        if(dir)
        {
                retVal = 0;