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 the Memory leak: nbuf #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

zengwei00
Copy link

fix the Memory leak: nbuf

Signed-off-by: zengwei zengwei1@uniontech.com

fix the Memory leak: nbuf
@@ -1554,6 +1554,7 @@ void a12_enqueue_blob(struct a12_state* S, const char* const buf,
a12int_trace(A12_TRACE_SYSTEM, "kind=error:status=ENOMEM");
DYNAMIC_FREE(*next);
*next = NULL;
DYNAMIC_FREE(*nbuf);
Copy link

@CorruptedVor CorruptedVor Aug 7, 2024

Choose a reason for hiding this comment

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

I think it's more likely that the check was supposed to be if (!nbuf) on line 1553, and assuming correct usage of calling it with a non-NULL buf.

Copy link

@CorruptedVor CorruptedVor Aug 7, 2024

Choose a reason for hiding this comment

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

This is still incomplete, there is never a check for whether nbuf was allocated sucessfully.

In fact, when nbuf allocation fails, this dereferences nbuf anyway (*nbuf), which hopefully causes SIGSEGV

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.

2 participants