Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed redundent free stmts #78

Merged
merged 8 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions traffic-mirroring/mirroring.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ int main(int argc, char **argv)
&tunnel_ifindex, 0);
if (ret) {
perror("ERROR: bpf_map_update_elem");
ret = EXIT_FAILURE;
return EXIT_FAILURE;
}
if (verbose) {
log_info("Change egress redirect ifindex to: %d", tunnel_ifindex);
Expand Down Expand Up @@ -919,13 +919,14 @@ int main(int argc, char **argv)
log_err("Error converting source address to network "
"address %s",
src_addr[i].addr);
free(src_key);
return (EXIT_FAILURE);
}
if (bpf_map_update_elem(src_fd, src_key, &src_val, 0) < 0) {
log_err("Failed to update source endpoint bpf map");
Atul-source marked this conversation as resolved.
Show resolved Hide resolved
perror("ERROR: bpf_map_update_elem");
ret = EXIT_FAILURE;
free(src_key);
return (EXIT_FAILURE);
}
}
free(src_key);
Expand Down Expand Up @@ -958,14 +959,14 @@ int main(int argc, char **argv)
log_err("Failed to convert destination address to network "
"address %s",
dst_addr[i].addr);
ret = EXIT_FAILURE;
free(dst_key);
free(dst_key);
return (EXIT_FAILURE);
}
Atul-source marked this conversation as resolved.
Show resolved Hide resolved
if (bpf_map_update_elem(dst_fd, dst_key, &dst_val, 0) < 0) {
log_err("Failed to update destination endpoint bpf map");
perror("ERROR: bpf_map_update_elem");
ret = EXIT_FAILURE;
free(dst_key);
Atul-source marked this conversation as resolved.
Show resolved Hide resolved
return (EXIT_FAILURE);
}
}
free(dst_key);
Expand All @@ -986,7 +987,7 @@ int main(int argc, char **argv)
ret = bpf_map_update_elem(ingress_any_fd, &key, &any_rep_ingress, 0);
if (ret) {
perror("ERROR: bpf_map_update_elem");
ret = EXIT_FAILURE;
return EXIT_FAILURE;
}
} else if (strcmp(direction, EGRESS) == 0) {
if (src_port_filter) {
Expand All @@ -1001,7 +1002,7 @@ int main(int argc, char **argv)
ret = bpf_map_update_elem(egress_any_fd, &key, &any_rep_egress, 0);
if (ret) {
perror("ERROR: bpf_map_update_elem");
ret = EXIT_FAILURE;
return EXIT_FAILURE;
}
}

Expand Down