diff options
author | Vitaly Chikunov <vt@altlinux.org> | 2022-01-09 02:34:57 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@users.noreply.github.com> | 2022-01-09 13:57:41 +0300 |
commit | eea1e27c2b49d7604df939aeefaa7f45a5519fc8 (patch) | |
tree | 151f2b5276cb700b76fc2f83724b6d1bbf7bb0dd /gost_prov.c | |
parent | 5dc8f91c186d88a74493c229c7afbf3eb40599a8 (diff) | |
download | gost-engine-eea1e27c2b49d7604df939aeefaa7f45a5519fc8.zip gost-engine-eea1e27c2b49d7604df939aeefaa7f45a5519fc8.tar.gz gost-engine-eea1e27c2b49d7604df939aeefaa7f45a5519fc8.tar.bz2 |
gost_prov: Avoid access to unallocated memory
This should fix Coverity warning:
*** CID 345245: (UNINIT)
/gost_prov.c: 71 in provider_ctx_new()
65 && populate_gost_engine(ctx->e)) {
66 ctx->core_handle = core;
67
68 /* Ugly hack */
69 err_handle = ctx->proverr_handle;
70 } else {
>>> CID 345245: (UNINIT)
>>> Using uninitialized value "ctx->e" when calling "provider_ctx_free".
71 provider_ctx_free(ctx);
72 ctx = NULL;
73 }
74 return ctx;
75 }
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Issue: #380
Diffstat (limited to 'gost_prov.c')
-rw-r--r-- | gost_prov.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gost_prov.c b/gost_prov.c index b4de15f..3d23765 100644 --- a/gost_prov.c +++ b/gost_prov.c @@ -58,7 +58,7 @@ static PROV_CTX *provider_ctx_new(const OSSL_CORE_HANDLE *core, { PROV_CTX *ctx; - if ((ctx = malloc(sizeof(*ctx))) != NULL + if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) != NULL && (ctx->proverr_handle = proverr_new_handle(core, in)) != NULL && (ctx->libctx = OSSL_LIB_CTX_new()) != NULL && (ctx->e = ENGINE_new()) != NULL |