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

confd: fix memory leak in lydx_new_path() #63

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

rical
Copy link
Contributor

@rical rical commented Jun 28, 2023

Disclaimer

This might break something. Please test your use case.
I didn't find any need for the "first" concept at all. I have tested to query the operational status for both ietf-system (confd) and ietf-interfaces (statd). Sysrepo is still able to report operational status in the same manner as before and the memory leak is fixed.

Here's what I used to test this:
sysrepocfg -X -d operational -m ietf-system
sysrepocfg -X -d operational -m ietf-interfaces

Patch

Prior to this patch, every new call to lydx_new_path() where "first" was set to 1 resulted in a memory leak of 72 bytes. Typically at least once for each sysrepo query.

The memory was allocated deep down in the lyd library, but as the parent node wasn't set (NULL) it wasn't found by sysrepo when cleaning up.

In this patch we mitigate this by simply removing the "first" concept, as it doesn't appear to be needed.

Prior to this patch, every new call to lydx_new_path() where "first"
was set to 1 resulted in a memory leak of 72 bytes. Typically at least
once for each sysrepo query.

The memory was allocated deep down in the lyd library, but as the
parent node wasn't set (NULL) it wasn't found by sysrepo when
cleaning up.

In this patch we mitigate this by simply removing the "first" concept,
as it doesn't appear to be needed.

Signed-off-by: Richard Alpe <richard@bit42.se>
@troglobit
Copy link
Contributor

Awesome work on tracking this leak down! LGTM and tests pass.

@troglobit troglobit merged commit 9d63aee into kernelkit:main Jun 29, 2023
1 check passed
@troglobit troglobit added this to the Infix v23.08 milestone Aug 30, 2023
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