diff options
| author | miod <> | 2014-05-18 16:18:13 +0000 |
|---|---|---|
| committer | miod <> | 2014-05-18 16:18:13 +0000 |
| commit | 7355c5fcf2d07a3c588063e6ed0c03e591856cd0 (patch) | |
| tree | b550db31967b3de58fe699bba2a1f7e240fb2e1f /src/lib/libc | |
| parent | 66bc77207bcbf83b89c91559987f2ececc38b01c (diff) | |
| download | openbsd-7355c5fcf2d07a3c588063e6ed0c03e591856cd0.tar.gz openbsd-7355c5fcf2d07a3c588063e6ed0c03e591856cd0.tar.bz2 openbsd-7355c5fcf2d07a3c588063e6ed0c03e591856cd0.zip | |
In OCSP_sendreq_bio(), cope with OCSP_sendreq_new() returning NULL.
ok jsing@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ocsp/ocsp_ht.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index f3ee29ccbb..3e7c2e46d0 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
| @@ -161,7 +161,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) | |||
| 161 | 161 | ||
| 162 | rctx = malloc(sizeof(OCSP_REQ_CTX)); | 162 | rctx = malloc(sizeof(OCSP_REQ_CTX)); |
| 163 | if (rctx == NULL) | 163 | if (rctx == NULL) |
| 164 | return 0; | 164 | return NULL; |
| 165 | rctx->state = OHS_ERROR; | 165 | rctx->state = OHS_ERROR; |
| 166 | rctx->mem = BIO_new(BIO_s_mem()); | 166 | rctx->mem = BIO_new(BIO_s_mem()); |
| 167 | rctx->io = io; | 167 | rctx->io = io; |
| @@ -174,7 +174,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) | |||
| 174 | if (!rctx->iobuf) { | 174 | if (!rctx->iobuf) { |
| 175 | BIO_free(rctx->mem); | 175 | BIO_free(rctx->mem); |
| 176 | free(rctx); | 176 | free(rctx); |
| 177 | return 0; | 177 | return NULL; |
| 178 | } | 178 | } |
| 179 | if (!path) | 179 | if (!path) |
| 180 | path = "/"; | 180 | path = "/"; |
| @@ -183,14 +183,14 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) | |||
| 183 | free(rctx->iobuf); | 183 | free(rctx->iobuf); |
| 184 | BIO_free(rctx->mem); | 184 | BIO_free(rctx->mem); |
| 185 | free(rctx); | 185 | free(rctx); |
| 186 | return 0; | 186 | return NULL; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { | 189 | if (req && !OCSP_REQ_CTX_set1_req(rctx, req)) { |
| 190 | free(rctx->iobuf); | 190 | free(rctx->iobuf); |
| 191 | BIO_free(rctx->mem); | 191 | BIO_free(rctx->mem); |
| 192 | free(rctx); | 192 | free(rctx); |
| 193 | return 0; | 193 | return NULL; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | return rctx; | 196 | return rctx; |
| @@ -453,6 +453,8 @@ OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req) | |||
| 453 | int rv; | 453 | int rv; |
| 454 | 454 | ||
| 455 | ctx = OCSP_sendreq_new(b, path, req, -1); | 455 | ctx = OCSP_sendreq_new(b, path, req, -1); |
| 456 | if (ctx == NULL) | ||
| 457 | return NULL; | ||
| 456 | 458 | ||
| 457 | do { | 459 | do { |
| 458 | rv = OCSP_sendreq_nbio(&resp, ctx); | 460 | rv = OCSP_sendreq_nbio(&resp, ctx); |
