Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Brias
Copy link
Contributor

@Brias Brias commented Aug 9, 2025

Contribution description

This pull request fixes multiple memory leaks in the test cases and the RTRlib itself. All fixed memory leaks have been found by running valgrind --leak-check=full <path-to-test-case>.

Note: One memory leak still exists in test_dynamic_groups.c. To me it looks like it's caused by the test code and not the RTRlib and thus it can be fixed later.

Note: Valgrind shows memory leaks (still reachable) for the tests that start new threads. These are, however, not caused by any code in the tests or RTRlib but by the C runtime and thus can be ignored or rather ignores should be created for those leaks in the future.

Testing procedure

Run valgrind --leak-check=full <path-to-test-case> for each test with and without the changes of this pull request.

Issues/PRs references

n/a

Brias added 2 commits August 8, 2025 17:14
- When running the tests with Valgrind it detected multiple
  memory leaks; some of them were caused by missing calls to
  `free()` in the tests cases but others were real memory
  leaks within the RTRlib.
- Previously, whenever an existing ASPA record was removed by a new one,
  the provider ASN list of the replaced record was not freed resulting
  in a memory leak. Now, whenever a record is replaced, it is temporarily
  stored and once the new ASPA record table was successfully created, the
  provider ASN list of each replaced record is freed.
@Brias Brias self-assigned this Aug 9, 2025
@Brias Brias requested a review from tanneberger August 9, 2025 18:27
Copy link
Member

@tanneberger tanneberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good, couple of tiny things.

@@ -0,0 +1,24 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this config file?

Is this necessary, the RTRLIB_BGPSEC_ENABLED can also be passed via a command line to your compiler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This file is in the .gitignore and shouldn't be pushed. Idk how it got committed and pushed. I will remove it again.

return RTR_SUCCESS;
}

static void make_key()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad function name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants