diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index 37a11ba007..9f8e13d36f 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_lib.c,v 1.19 2023/07/28 10:28:02 tb Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.20 2023/08/22 08:44:15 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -144,15 +144,13 @@ cms_content_bio(CMS_ContentInfo *cms) | |||
| 144 | BIO * | 144 | BIO * |
| 145 | CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) | 145 | CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) |
| 146 | { | 146 | { |
| 147 | BIO *cmsbio, *cont; | 147 | BIO *cmsbio = NULL, *cont = NULL; |
| 148 | 148 | ||
| 149 | if (icont) | 149 | if ((cont = icont) == NULL) |
| 150 | cont = icont; | ||
| 151 | else | ||
| 152 | cont = cms_content_bio(cms); | 150 | cont = cms_content_bio(cms); |
| 153 | if (!cont) { | 151 | if (cont == NULL) { |
| 154 | CMSerror(CMS_R_NO_CONTENT); | 152 | CMSerror(CMS_R_NO_CONTENT); |
| 155 | return NULL; | 153 | goto err; |
| 156 | } | 154 | } |
| 157 | switch (OBJ_obj2nid(cms->contentType)) { | 155 | switch (OBJ_obj2nid(cms->contentType)) { |
| 158 | 156 | ||
| @@ -177,13 +175,16 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) | |||
| 177 | 175 | ||
| 178 | default: | 176 | default: |
| 179 | CMSerror(CMS_R_UNSUPPORTED_TYPE); | 177 | CMSerror(CMS_R_UNSUPPORTED_TYPE); |
| 180 | return NULL; | 178 | goto err; |
| 181 | } | 179 | } |
| 182 | 180 | ||
| 183 | if (cmsbio) | 181 | if (cmsbio == NULL) |
| 184 | return BIO_push(cmsbio, cont); | 182 | goto err; |
| 183 | |||
| 184 | return BIO_push(cmsbio, cont); | ||
| 185 | 185 | ||
| 186 | if (!icont) | 186 | err: |
| 187 | if (cont != icont) | ||
| 187 | BIO_free(cont); | 188 | BIO_free(cont); |
| 188 | 189 | ||
| 189 | return NULL; | 190 | return NULL; |
