Skip to content

Commit

Permalink
Remove unnecessary checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pushkarnk committed Sep 17, 2024
1 parent 10cfa8e commit e430da3
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/main/native/c/drbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ DRBG* create_DRBG_with_params(const char* name, DRBG* parent, DRBGParams *drbg_p
EVP_RAND_CTX * context = EVP_RAND_CTX_new(rand, parent == NULL ? NULL : parent->context);
if (NULL == context) {
EVP_RAND_free(rand);
rand = NULL;
fprintf(stderr, "Couldn't allocate EVP_RAND_CTX\n");
return NULL;
}
Expand Down Expand Up @@ -104,25 +103,11 @@ int free_DRBG(DRBG *generator) {
if (generator == NULL) {
return 0;
}

free_DRBGParams(generator->params);
free_DRBG(generator->parent);
FREE_IF_NON_NULL(generator->seed);
if (generator->context != NULL) {
EVP_RAND_CTX_free(generator->context);
generator->context = NULL;
}

if (generator->params != NULL) {
free_DRBGParams(generator->params);
generator->params = NULL;
}

if (generator->parent != NULL) {
free_DRBG(generator->parent);
generator->parent = NULL;
}

EVP_RAND_CTX_free(generator->context);
free(generator);
generator = NULL;
return 1;
}

Expand Down

0 comments on commit e430da3

Please sign in to comment.