check if pointer is != NULL before dereferencing it (Coverity CID 40)
authorNils Larsch <nils@openssl.org>
Mon, 2 Apr 2007 20:02:27 +0000 (20:02 +0000)
committerNils Larsch <nils@openssl.org>
Mon, 2 Apr 2007 20:02:27 +0000 (20:02 +0000)
crypto/dso/dso_dlfcn.c

index f7c08973f42e502c246df6b0929347beac798d6d..979fca80654f850d7bad358fd9fe426971111cc7 100644 (file)
@@ -296,13 +296,12 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
                }
        /* If the first file specification is a rooted path, it rules.
           same goes if the second file specification is missing. */
-       if (!filespec2 || filespec1[0] == '/')
+       if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/'))
                {
                merged = OPENSSL_malloc(strlen(filespec1) + 1);
                if(!merged)
                        {
-                       DSOerr(DSO_F_DLFCN_MERGER,
-                               ERR_R_MALLOC_FAILURE);
+                       DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
                        return(NULL);
                        }
                strcpy(merged, filespec1);