Skip to content

Commit

Permalink
Remove some memory leaks
Browse files Browse the repository at this point in the history
Still zome left in ldns-verify-zone, but leaving it for now
  • Loading branch information
wtoorop committed Jul 12, 2024
1 parent 025051d commit 28bb3ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/16-unit-tests-edns.tpkg/16-unit-tests-edns.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ check_option(void)
return 0;
}

ldns_edns_free(edns);
ldns_edns_deep_free(edns);

edns = ldns_edns_new_from_data(LDNS_EDNS_EDE, 4, hex_data);

Expand All @@ -94,7 +94,6 @@ check_option(void)

ldns_edns_deep_free(edns);
ldns_edns_deep_free(clone);

return 1;
}

Expand Down Expand Up @@ -185,6 +184,7 @@ check_option_list(void)
if (ldns_buffer_read_u8(buf) != hex_data[i]) {
printf("Error: EDNS data is incorrect: %d, %d\n",
ldns_buffer_read_u8_at(buf, i), hex_data[i]);
ldns_buffer_free(buf);
return 0;
}
}
Expand All @@ -195,9 +195,12 @@ check_option_list(void)
if (ldns_buffer_read_u8(buf) != hex_data2[i]) {
printf("Error: EDNS data is incorrect: %d, %d\n",
ldns_buffer_read_u8_at(buf, i), hex_data2[i]);
ldns_buffer_free(buf);
return 0;
}
}
ldns_buffer_free(buf);
buf = NULL;

/* Replace the first option with a copy of the second */
option = ldns_edns_new_from_data(LDNS_EDNS_PADDING, 5, hex_data2);
Expand Down Expand Up @@ -232,6 +235,7 @@ check_option_list(void)

if (!(check_option_list_entries(clone, option, 1, LDNS_EDNS_PADDING, 5, hex_data2))) {
printf("Error: EDNS list entries are incorrect\n");
ldns_edns_option_list_deep_free(clone);
return 0;
}

Expand All @@ -245,7 +249,7 @@ check_option_list(void)
return 0;
}

ldns_edns_option_list_free(clone);
ldns_edns_option_list_deep_free(clone);

ldns_edns_option_list_deep_free(list);

Expand Down

0 comments on commit 28bb3ff

Please sign in to comment.