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

fix rclc_example: memory leaking in msg.data allocation #386

Merged
merged 1 commit into from
Jul 28, 2023
Merged

fix rclc_example: memory leaking in msg.data allocation #386

merged 1 commit into from
Jul 28, 2023

Conversation

Zard-C
Copy link
Contributor

@Zard-C Zard-C commented Jul 28, 2023

Fix bug: memory leaking while msg.data allocation.

This bug is caused by using malloc allocate memory for the std_msg.data.data, but we call std_msgs__msg__String__init(), msg.data.data was allocated a block memory which size is 1, thus we should use allocator.reallocate to reallocate memory for msg.data.data.

Fixes #385

Signed-off-by: Zard-C [email protected]

@codecov-commenter
Copy link

Codecov Report

Merging #386 (3a1d6cb) into humble (27703c2) will decrease coverage by 0.08%.
Report is 2 commits behind head on humble.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           humble     #386      +/-   ##
==========================================
- Coverage   69.13%   69.06%   -0.08%     
==========================================
  Files          16       16              
  Lines        2715     2715              
  Branches      765      765              
==========================================
- Hits         1877     1875       -2     
- Misses        451      452       +1     
- Partials      387      388       +1     

see 1 file with indirect coverage changes

Copy link
Contributor

@JanStaschulat JanStaschulat left a comment

Choose a reason for hiding this comment

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

LGTM

@JanStaschulat
Copy link
Contributor

@Zard-C thank you for this pull request!

@JanStaschulat
Copy link
Contributor

@Mergifyio backport rolling

@mergify
Copy link
Contributor

mergify bot commented Jul 28, 2023

backport rolling

✅ Backports have been created

@JanStaschulat JanStaschulat merged commit 7af2054 into ros2:humble Jul 28, 2023
3 checks passed
mergify bot pushed a commit that referenced this pull request Jul 28, 2023
Signed-off-by: zhangtonghe <[email protected]>
Co-authored-by: zhangtonghe <[email protected]>
(cherry picked from commit 7af2054)
@Zard-C Zard-C mentioned this pull request Jul 28, 2023
@Zard-C Zard-C deleted the fix/rclc_example branch July 28, 2023 09:42
Zard-C added a commit to Zard-C/rclc that referenced this pull request Aug 21, 2023
Co-authored-by: zhangtonghe <[email protected]>
(cherry picked from commit 7af2054)
Signed-off-by: Zard-C <[email protected]>
JanStaschulat added a commit that referenced this pull request Aug 22, 2023
… (#387)

* fix rclc_example: memory leaking in msg.data allocation (#386)

Signed-off-by: zhangtonghe <[email protected]>
Co-authored-by: zhangtonghe <[email protected]>
(cherry picked from commit 7af2054)

* fix: deprecated rcl_timer_init (#389)

* fix: deprecated rcl_timer_init

Signed-off-by: Zard-C <[email protected]>
Signed-off-by: zhangtonghe <[email protected]>
Signed-off-by: Zard-C <[email protected]>

* fix: switch rcl_timer_init to rcl_timer_init2

Signed-off-by: Zard-C <[email protected]>
Signed-off-by: zhangtonghe <[email protected]>
Signed-off-by: Zard-C <[email protected]>

* update rclc_timer_init_default and it's invokation

Signed-off-by: zhangtonghe <[email protected]>
Signed-off-by: Zard-C <[email protected]>

* Revert "update rclc_timer_init_default and it's invokation"

This reverts commit ebc3edb.

Signed-off-by: zhangtonghe <[email protected]>
Signed-off-by: Zard-C <[email protected]>

* fix: rcl_timer_init usage

Combined changes from multiple commits to refactor the usage of rcl_timer_init for better compatibility and clarity.

Signed-off-by: Zard-C <[email protected]>
Signed-off-by: zhangtonghe <[email protected]>

* Update rclc/include/rclc/timer.h

Co-authored-by: Jan Staschulat <[email protected]>
Signed-off-by: Zard-C <[email protected]>

---------

Signed-off-by: Zard-C <[email protected]>
Signed-off-by: zhangtonghe <[email protected]>
Co-authored-by: zhangtonghe <[email protected]>
Co-authored-by: Jan Staschulat <[email protected]>

---------

Signed-off-by: Zard-C <[email protected]>
Signed-off-by: zhangtonghe <[email protected]>
Co-authored-by: Zard-C <[email protected]>
Co-authored-by: zhangtonghe <[email protected]>
Co-authored-by: Jan Staschulat <[email protected]>
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.

4 participants