Skip to content

Commit

Permalink
ldns_convert_dsa_rrsig_rdf2asn1: fix memory leak
Browse files Browse the repository at this point in the history
Prior to this change `dsasig` was not freed when calling `DSA_SIG_set0`
failed. Free `dsasig` on error in that code path now.

Reported by:	Coverity
Signed-off-by: Enji Cooper <[email protected]>
  • Loading branch information
ngie-eign committed Jun 6, 2024
1 parent d97c539 commit 5afb814
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dnssec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1836,8 +1836,10 @@ ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer,
return LDNS_STATUS_MEM_ERR;
}
# ifdef HAVE_DSA_SIG_SET0
if (! DSA_SIG_set0(dsasig, R, S))
return LDNS_STATUS_SSL_ERR;
if (! DSA_SIG_set0(dsasig, R, S)) {
DSA_SIG_free(dsasig);
return LDNS_STATUS_SSL_ERR;
}
# else
dsasig->r = R;
dsasig->s = S;
Expand Down

0 comments on commit 5afb814

Please sign in to comment.