X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Focsp%2Focsp_ht.c;h=f69d4df3b7dd2eec36b283dd8219a07cb5c8a0cc;hb=9ff9bccc41c385ec2aa8ee2123f083b52b56b7b4;hp=266b43b00a2fe0cfdec77afc79a4babee2e0bae6;hpb=895cba195a0c8430dcc8d1aa22b75eccaaee8f49;p=oweals%2Fopenssl.git diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c index 266b43b00a..f69d4df3b7 100644 --- a/crypto/ocsp/ocsp_ht.c +++ b/crypto/ocsp/ocsp_ht.c @@ -1,4 +1,3 @@ -/* ocsp_ht.c */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project * 2006. @@ -113,21 +112,20 @@ static int parse_http_line1(char *line); OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline) { - OCSP_REQ_CTX *rctx; - rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX)); - if (!rctx) + OCSP_REQ_CTX *rctx = OPENSSL_zalloc(sizeof(*rctx)); + + if (rctx == NULL) return NULL; rctx->state = OHS_ERROR; rctx->max_resp_len = OCSP_MAX_RESP_LENGTH; rctx->mem = BIO_new(BIO_s_mem()); rctx->io = io; - rctx->asn1_len = 0; if (maxline > 0) rctx->iobuflen = maxline; else rctx->iobuflen = OCSP_MAX_LINE_LEN; rctx->iobuf = OPENSSL_malloc(rctx->iobuflen); - if (!rctx->iobuf || !rctx->mem) { + if (rctx->iobuf == NULL || rctx->mem == NULL) { OCSP_REQ_CTX_free(rctx); return NULL; } @@ -139,8 +137,7 @@ void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) if (!rctx) return; BIO_free(rctx->mem); - if (rctx->iobuf) - OPENSSL_free(rctx->iobuf); + OPENSSL_free(rctx->iobuf); OPENSSL_free(rctx); } @@ -234,7 +231,7 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, OCSP_REQ_CTX *rctx = NULL; rctx = OCSP_REQ_CTX_new(io, maxline); - if (!rctx) + if (rctx == NULL) return NULL; if (!OCSP_REQ_CTX_http(rctx, "POST", path)) @@ -535,7 +532,7 @@ OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req) ctx = OCSP_sendreq_new(b, path, req, -1); - if (!ctx) + if (ctx == NULL) return NULL; do {