-
Notifications
You must be signed in to change notification settings - Fork 167
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
Out-of-scope memory use and memory leak issue #172
Conversation
temp going out of scope leaks the storage it points to resource leak from local_namespace_ Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
rcl/src/rcl/node.c
Outdated
@@ -163,6 +165,7 @@ rcl_node_init( | |||
ret = rmw_validate_namespace(local_namespace_, &validation_result, NULL); | |||
if (ret != RMW_RET_OK) { | |||
RCL_SET_ERROR_MSG(rmw_get_error_string_safe(), *allocator); | |||
allocator->deallocate((char *)local_namespace_, allocator->state); |
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.
This cannot be done if line 147 is executed (if local_namespace_
is a literal string). I think it needs to check should_free_local_namespace_
.
Here and below.
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.
exactly, thanks !
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.
Signed-off-by: Ethan Gao <ethan.gao@linux.intel.com>
Thanks @gaoethan! |
I don't think the scope of the variable needs to be increased. The scope of |
You’re right, I’ll make a follow up pr ASAP. |
temp
going out of scope leaks the storage it points toresource leak from
local_namespace_
Signed-off-by: Ethan Gao ethan.gao@linux.intel.com