Skip to content

Commit

Permalink
gost_prov: OPENSSL_free what is OPENSSL_zalloc'd
Browse files Browse the repository at this point in the history
  *** CID 345254:  API usage errors  (ALLOC_FREE_MISMATCH)
  /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 345254:  API usage errors  (ALLOC_FREE_MISMATCH)
  >>>     Calling "provider_ctx_free" frees "ctx" using "free" but it should have been freed using "CRYPTO_free".
  71             provider_ctx_free(ctx);
  72             ctx = NULL;
  73         }
  74         return ctx;
  75     }

Fixes: f5a3951 ("gost_prov: Avoid access to unallocated memory")
Signed-off-by: Vitaly Chikunov <[email protected]>
  • Loading branch information
vt-alt authored and beldmit committed Jan 10, 2022
1 parent eea1e27 commit da0c648
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gost_prov.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void provider_ctx_free(PROV_CTX *ctx)
proverr_free_handle(ctx->proverr_handle);
OSSL_LIB_CTX_free(ctx->libctx);
}
free(ctx);
OPENSSL_free(ctx);
}

extern int populate_gost_engine(ENGINE *e);
Expand Down

0 comments on commit da0c648

Please sign in to comment.