-/* dso_dl.c -*- mode:C; c-file-style: "eay" -*- */
/*
* Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
* 2000.
* if the second file specification is missing.
*/
if (!filespec2 || filespec1[0] == '/') {
- merged = OPENSSL_malloc(strlen(filespec1) + 1);
- if (!merged) {
+ merged = OPENSSL_strdup(filespec1);
+ if (merged == NULL) {
DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE);
return (NULL);
}
- strcpy(merged, filespec1);
}
/*
* If the first file specification is missing, the second one rules.
*/
else if (!filespec1) {
- merged = OPENSSL_malloc(strlen(filespec2) + 1);
- if (!merged) {
+ merged = OPENSSL_strdup(filespec2);
+ if (merged == NULL) {
DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE);
return (NULL);
}
- strcpy(merged, filespec2);
} else
/*
* This part isn't as trivial as it looks. It assumes that the
len--;
}
merged = OPENSSL_malloc(len + 2);
- if (!merged) {
+ if (merged == NULL) {
DSOerr(DSO_F_DL_MERGER, ERR_R_MALLOC_FAILURE);
return (NULL);
}