Skip to content
Snippets Groups Projects
Commit 5f89e6a4 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Add free dynamic memory before error return

Coverity #742091 (resource leak)
parent 487d4b4f
No related branches found
No related tags found
No related merge requests found
......@@ -408,11 +408,13 @@ static int test_edns_wire()
if (wire_size == -1) {
diag("Could not create EDNS wire");
free(wire);
return 0;
}
knot_opt_rr_t *edns_from_wire = knot_edns_new();
if (edns_from_wire == NULL) {
free(wire);
return 0;
}
......@@ -422,6 +424,7 @@ static int test_edns_wire()
wire,
100) <= 0) {
diag("Could not create from wire");
free(wire);
return 0;
}
......@@ -511,12 +514,14 @@ static int test_edns_has_option()
test_edns_data[i].options[j].
data) != 0) {
diag("Could not add option");
knot_edns_free(&edns);
return 0;
}
if (knot_edns_has_option(edns,
test_edns_data[i].options[j].code) != 1) {
diag("Option not found!");
knot_edns_free(&edns);
return 0;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment