Memory allocation checks.
PR#3399.
This commit is contained in:
parent
ad212c1ed1
commit
da0d5e78bc
@ -158,6 +158,8 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
|
|||||||
|
|
||||||
OCSP_REQ_CTX *rctx;
|
OCSP_REQ_CTX *rctx;
|
||||||
rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX));
|
rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX));
|
||||||
|
if (!rctx)
|
||||||
|
return NULL;
|
||||||
rctx->state = OHS_ERROR;
|
rctx->state = OHS_ERROR;
|
||||||
rctx->mem = BIO_new(BIO_s_mem());
|
rctx->mem = BIO_new(BIO_s_mem());
|
||||||
rctx->io = io;
|
rctx->io = io;
|
||||||
@ -167,18 +169,21 @@ OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
|
|||||||
else
|
else
|
||||||
rctx->iobuflen = OCSP_MAX_LINE_LEN;
|
rctx->iobuflen = OCSP_MAX_LINE_LEN;
|
||||||
rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
|
rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
|
||||||
if (!rctx->iobuf)
|
if (!rctx->mem || !rctx->iobuf)
|
||||||
return 0;
|
goto err;
|
||||||
if (!path)
|
if (!path)
|
||||||
path = "/";
|
path = "/";
|
||||||
|
|
||||||
if (BIO_printf(rctx->mem, post_hdr, path) <= 0)
|
if (BIO_printf(rctx->mem, post_hdr, path) <= 0)
|
||||||
return 0;
|
goto err;
|
||||||
|
|
||||||
if (req && !OCSP_REQ_CTX_set1_req(rctx, req))
|
if (req && !OCSP_REQ_CTX_set1_req(rctx, req))
|
||||||
return 0;
|
goto err;
|
||||||
|
|
||||||
return rctx;
|
return rctx;
|
||||||
|
err:
|
||||||
|
OCSP_REQ_CTX_free(rctx);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the HTTP response. This will look like this:
|
/* Parse the HTTP response. This will look like this:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user