diff options
author | tedu <> | 2014-04-23 21:54:30 +0000 |
---|---|---|
committer | tedu <> | 2014-04-23 21:54:30 +0000 |
commit | 40e1b308306633da3204f243350176f8b3d377af (patch) | |
tree | 51472f3b7b5c6b52c0e273040c476fc4aade2dd5 /src/lib/libcrypto/dso/dso_lib.c | |
parent | 19826178d23fb598dbbfc0bf856cf8a6842827db (diff) | |
download | openbsd-40e1b308306633da3204f243350176f8b3d377af.tar.gz openbsd-40e1b308306633da3204f243350176f8b3d377af.tar.bz2 openbsd-40e1b308306633da3204f243350176f8b3d377af.zip |
replace a bunch of hand duped strings with strdup
Diffstat (limited to 'src/lib/libcrypto/dso/dso_lib.c')
-rw-r--r-- | src/lib/libcrypto/dso/dso_lib.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index ae10104560..882b9c2fcb 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
@@ -356,12 +356,11 @@ DSO_set_filename(DSO *dso, const char *filename) | |||
356 | return (0); | 356 | return (0); |
357 | } | 357 | } |
358 | /* We'll duplicate filename */ | 358 | /* We'll duplicate filename */ |
359 | copied = malloc(strlen(filename) + 1); | 359 | copied = strdup(filename); |
360 | if (copied == NULL) { | 360 | if (copied == NULL) { |
361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); | 361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); |
362 | return (0); | 362 | return (0); |
363 | } | 363 | } |
364 | strlcpy(copied, filename, strlen(filename) + 1); | ||
365 | if (dso->filename) | 364 | if (dso->filename) |
366 | free(dso->filename); | 365 | free(dso->filename); |
367 | dso->filename = copied; | 366 | dso->filename = copied; |
@@ -409,13 +408,12 @@ DSO_convert_filename(DSO *dso, const char *filename) | |||
409 | result = dso->meth->dso_name_converter(dso, filename); | 408 | result = dso->meth->dso_name_converter(dso, filename); |
410 | } | 409 | } |
411 | if (result == NULL) { | 410 | if (result == NULL) { |
412 | result = malloc(strlen(filename) + 1); | 411 | result = strdup(filename); |
413 | if (result == NULL) { | 412 | if (result == NULL) { |
414 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, | 413 | DSOerr(DSO_F_DSO_CONVERT_FILENAME, |
415 | ERR_R_MALLOC_FAILURE); | 414 | ERR_R_MALLOC_FAILURE); |
416 | return (NULL); | 415 | return (NULL); |
417 | } | 416 | } |
418 | strlcpy(result, filename, strlen(filename) + 1); | ||
419 | } | 417 | } |
420 | return (result); | 418 | return (result); |
421 | } | 419 | } |