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 some memory leaks in the NBD server and enable asan for the tests #1374

Merged
merged 7 commits into from Apr 4, 2024

Conversation

jluebbe
Copy link
Member

@jluebbe jluebbe commented Mar 28, 2024

Most of the nbd asan tests are not running in the CI, as we're not using qemu there, yet.

Also move some local variables to a smaller scope.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
As we don't need the headers in GStrv form, remove that struct member
and convert them to curl_slists immediately.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Now that the remaining memory leaks are fixed, we can enable address
sanitizer in CI.

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

codecov bot commented Mar 28, 2024

Codecov Report

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

Project coverage is 79.92%. Comparing base (ec9ab08) to head (372fce7).
Report is 3 commits behind head on master.

Files Patch % Lines
src/nbd.c 6.25% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1374      +/-   ##
==========================================
- Coverage   79.95%   79.92%   -0.04%     
==========================================
  Files          67       67              
  Lines       20057    20066       +9     
==========================================
+ Hits        16037    16038       +1     
- Misses       4020     4028       +8     

☔ 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 to have the nbd c module asan-tested \o/


/* only read from the client on the first try */
if (!ctx->url) {
g_autofree guint8 *data = g_malloc(xfer->request.len);
g_autoptr(GVariant) v = NULL;
g_auto(GVariantDict) dict = G_VARIANT_DICT_INIT(NULL);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe note that this changes from stack-allocated to heap-allocated and that the former variant lacked the g_variant_dict_clear() call?

Also, the commit contains an unrelated newline change and unrelated code move. But since the result is still clear enough to read I'd be fine with that.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is still stack-allocated, which is what g_auto is used for.

Copy link
Member

Choose a reason for hiding this comment

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

Ouh, right. My fault.

src/nbd.c Show resolved Hide resolved
@ejoerns ejoerns merged commit 1b0b9a4 into rauc:master Apr 4, 2024
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants