Skip to content

Commit

Permalink
Improved dup-key test
Browse files Browse the repository at this point in the history
  • Loading branch information
olszomal committed Oct 21, 2024
1 parent 9b20ef7 commit ab88774
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/dup-key.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ int main(int argc, char *argv[])
goto end;
}

/*
* ENGINE_init() returned a functional reference, so free the structural
* reference from ENGINE_by_id().
*/
ENGINE_free(engine);
pkey = ENGINE_load_private_key(engine, privkey, 0, 0);

if (pkey == NULL) {
Expand Down Expand Up @@ -158,15 +163,15 @@ int main(int argc, char *argv[])
/* Do it one more time */
pkey = ENGINE_load_private_key(engine, privkey, 0, 0);

/* Free the functional reference from ENGINE_init */
ENGINE_finish(engine);
if (pkey == NULL) {
printf("Could not load key\n");
display_openssl_errors(__LINE__);
ret = 1;
goto end;
}

ENGINE_finish(engine);

ret = 0;

CONF_modules_unload(1);
Expand Down

0 comments on commit ab88774

Please sign in to comment.