-
Notifications
You must be signed in to change notification settings - Fork 10
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
utils: fix leaks for map unpacking #40
Conversation
Signed-off-by: David Korczynski <[email protected]>
Specifically, it's not a general solution because the leaks happens other values set similarly across |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the definition of context_to_free
to the beginning of the function and reneame it as context_to_release
if possible while at it.
Signed-off-by: David Korczynski <[email protected]>
Actually, I'm sorry David, even though the style request was technically correct, I didn't pay attention to what the change actually was. I think the change is wrong because the conditional branch you put that cleanup in is something that should be handled by the caller. What happens when the map key handler returns anything but From what I can see the issue in this case is that in line 569 we shouldn't return the result of the Please correct me if I'm wrong or let me know if you have any questions. |
I tried this Leonardo, but it didn't work and in general I don't think it's possible to have the fix there. The problem is that the leak happens in a loop where the loop itself doesn't have knowledge of the underlying element, which in this case has the consequence it cannot free all data associated with the element. This is what I meant from the initial PR text This is because the dynamically allocated memory attached to context which is typecasted in the callees but is never casted back in case of needing to clean up.. I think in essence there is missing information available when unpacking map/arrays and this makes it tricky to clean it up. The problem is if parts of the elements in the map/arrays are succesfully unpacked but the unpacking later fails, then it seems like leaks happen. I think this extends further than spans as well. |
Could you please share the patch you applied so I can assist you with it? It's probably something simple because I'm fairly sure that it can be addressed in this way. |
Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
Signed-off-by: David Korczynski <[email protected]>
@edsiper this PR should be merged ASAP. Should @DavidKorczynski increase the patch level in this PR or will we do it afterwards? |
@leonardo-albertovich pls bump it, thank you |
Fixes several leaks in ctraces, including: