diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_meth.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_meth.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_meth.c b/src/lib/libcrypto/rsa/rsa_meth.c index 8ae929dc3d..d6be1ea006 100644 --- a/src/lib/libcrypto/rsa/rsa_meth.c +++ b/src/lib/libcrypto/rsa/rsa_meth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_meth.c,v 1.4 2022/01/07 09:55:32 tb Exp $ */ | 1 | /* $OpenBSD: rsa_meth.c,v 1.5 2022/07/04 12:23:30 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -42,10 +42,11 @@ RSA_meth_new(const char *name, int flags) | |||
| 42 | void | 42 | void |
| 43 | RSA_meth_free(RSA_METHOD *meth) | 43 | RSA_meth_free(RSA_METHOD *meth) |
| 44 | { | 44 | { |
| 45 | if (meth != NULL) { | 45 | if (meth == NULL) |
| 46 | free((char *)meth->name); | 46 | return; |
| 47 | free(meth); | 47 | |
| 48 | } | 48 | free(meth->name); |
| 49 | free(meth); | ||
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | RSA_METHOD * | 52 | RSA_METHOD * |
| @@ -67,12 +68,12 @@ RSA_meth_dup(const RSA_METHOD *meth) | |||
| 67 | int | 68 | int |
| 68 | RSA_meth_set1_name(RSA_METHOD *meth, const char *name) | 69 | RSA_meth_set1_name(RSA_METHOD *meth, const char *name) |
| 69 | { | 70 | { |
| 70 | char *copy; | 71 | char *new_name; |
| 71 | 72 | ||
| 72 | if ((copy = strdup(name)) == NULL) | 73 | if ((new_name = strdup(name)) == NULL) |
| 73 | return 0; | 74 | return 0; |
| 74 | free((char *)meth->name); | 75 | free(meth->name); |
| 75 | meth->name = copy; | 76 | meth->name = new_name; |
| 76 | return 1; | 77 | return 1; |
| 77 | } | 78 | } |
| 78 | 79 | ||
