Skip to content

Commit

Permalink
Merge pull request #191 from FGasper/16-unit-tests-edns-fix-leak
Browse files Browse the repository at this point in the history
16-unit-tests-edns: Fix leak & warnings
  • Loading branch information
wtoorop authored Jul 12, 2024
2 parents d7767a6 + 2f9c9a5 commit 8f1640d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/16-unit-tests-edns.tpkg/16-unit-tests-edns.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ check_option_entries(ldns_edns_option *edns, ldns_edns_option_code code,

buf = ldns_edns_get_wireformat_buffer(edns);
if (ldns_buffer_read_u16(buf) != code) {
ldns_buffer_free(buf);
printf("Error: EDNS type is incorrect\n");
return 0;
}
if (ldns_buffer_read_u16(buf) != size) {
ldns_buffer_free(buf);
printf("Error: EDNS length is incorrect\n");
return 0;
}
Expand All @@ -46,15 +48,17 @@ check_option_entries(ldns_edns_option *edns, ldns_edns_option_code code,
if (ldns_buffer_read_u8_at(buf, i+4) != hex_data[i]) {
printf("Error: EDNS data is incorrect: %d, %d\n",
ldns_buffer_read_u8_at(buf, i+4), hex_data[i]);
ldns_buffer_free(buf);
return 0;
}
}

ldns_buffer_free(buf);
return 1;
}

static int
check_option()
check_option(void)
{
ldns_edns_option *edns;
ldns_edns_option *clone;
Expand Down Expand Up @@ -119,7 +123,7 @@ static int check_option_list_entries(ldns_edns_option_list *list,
}

static int
check_option_list()
check_option_list(void)
{
size_t size, i;
ldns_edns_option_list* list;
Expand Down

0 comments on commit 8f1640d

Please sign in to comment.