Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix csr_ptr leak
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed Apr 30, 2024
1 parent f35854f commit 597c115
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,15 +1484,20 @@ static int handle_cert_gen_locked(camblet_socket *sc)
csr_sign_answer *csr_sign_answer;
csr_sign_answer = send_csrsign_command(csr_ptr, sc->opa_socket_ctx.ttl);
if (IS_ERR(csr_sign_answer))
{
kfree(csr_ptr);
return PTR_ERR(csr_sign_answer);
}
if (csr_sign_answer->error)
{
pr_err("error during CSR signing # err[%s]", csr_sign_answer->error);
kfree(csr_ptr);
x509_certificate_put(csr_sign_answer->cert);
csr_sign_answer_free(csr_sign_answer);
return -1;
}

kfree(csr_ptr);
x509_certificate_get(csr_sign_answer->cert);
sc->cert = csr_sign_answer->cert;
csr_sign_answer_free(csr_sign_answer);
Expand Down

0 comments on commit 597c115

Please sign in to comment.