check if pointer is != NULL before dereferencing it (Coverity CID 40)

This commit is contained in:
Nils Larsch 2007-04-02 20:02:27 +00:00
parent 9babf3929b
commit c971ca4c86

View 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. /* If the first file specification is a rooted path, it rules.
same goes if the second file specification is missing. */ 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); merged = OPENSSL_malloc(strlen(filespec1) + 1);
if(!merged) if(!merged)
{ {
DSOerr(DSO_F_DLFCN_MERGER, DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
ERR_R_MALLOC_FAILURE);
return(NULL); return(NULL);
} }
strcpy(merged, filespec1); strcpy(merged, filespec1);