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 leaks discovered via shell based tests #1380

Merged
merged 9 commits into from Apr 10, 2024
Merged

Conversation

jluebbe
Copy link
Member

@jluebbe jluebbe commented Apr 5, 2024

So far, we've only run the C-based test suite with address sanitized and fixed the resulting issues.

This PR fixes issues detected by running ./qemu-test with a asan enabled and prepares for enabling these checks in CI as well.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
We need to free the previous string, so use the r_replace_strdup helper.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
As the process exits shortly after returning from the affected
functions, the leak didn't cause any problems. Fixing it makes the
address sanitizer output more useful, though.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
So far, the RaucContext was not freed when called from main(). Before we
can do that, we need to make sure that the g_autofree strings confpath,
keyring and mount are not freed twice. Use g_steal_pointer to indicate
that the context takes ownership.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
This avoids some leak reports from address sanitizer, so that we can
focus on real leaks.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
The RaucStatusPrint needs to free the memory it may have received from
the service. In the non-service case, we need to copy or reference this
data.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 79.96%. Comparing base (268a003) to head (b989694).

Files Patch % Lines
src/bundle.c 50.00% 2 Missing ⚠️
src/context.c 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1380      +/-   ##
==========================================
- Coverage   79.97%   79.96%   -0.01%     
==========================================
  Files          67       67              
  Lines       20073    20073              
==========================================
- Hits        16053    16052       -1     
- Misses       4020     4021       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ejoerns ejoerns left a comment

Choose a reason for hiding this comment

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

Great work! 👍

@ejoerns ejoerns merged commit 7a7512b into rauc:master Apr 10, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants