KEMBAR78
Fix duplicate header leak in ACLK HTTPS client by ktsaou · Pull Request #21084 · netdata/netdata · GitHub
Skip to content

Conversation

@ktsaou
Copy link
Member

@ktsaou ktsaou commented Oct 1, 2025

  • free the previous allocation when the same header key is seen again
  • keep parser init/reset safety tweaks from the local branch

Fixes #21083

In other works, aclk was leaking the value of each duplicate http response header key received. It was using the last, but all previous were leaked. Now it frees duplicates before allocating a new one (still uses the last one).

@ktsaou ktsaou requested a review from stelfrag as a code owner October 1, 2025 21:30
}
void *prev_val = NULL;
if (!c_rhash_get_ptr_by_str(parse_ctx->headers, key, &prev_val))
freez(prev_val); // drop previous allocation before overwriting
Copy link
Member Author

@ktsaou ktsaou Oct 1, 2025

Choose a reason for hiding this comment

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

@stelfrag if you don't want to keep the rest, the above 2 lines fix the actual leak.

All the others are supposed to make this more robust.

@stelfrag stelfrag merged commit 41d9554 into netdata:master Oct 2, 2025
108 checks passed
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Oct 3, 2025
fix(aclk): free previous header values before overwrite

Refs: netdata#21083
(cherry picked from commit 41d9554)
@stelfrag stelfrag mentioned this pull request Oct 3, 2025
Ferroin pushed a commit that referenced this pull request Oct 15, 2025
fix(aclk): free previous header values before overwrite

Refs: #21083
(cherry picked from commit 41d9554)
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.

[Bug]: aclk memory leak

2 participants