Skip to content

fix the Memory leak: nbuf#297

Open
zengwei00 wants to merge 1 commit intoletoram:masterfrom
zengwei00:patch-6
Open

fix the Memory leak: nbuf#297
zengwei00 wants to merge 1 commit intoletoram:masterfrom
zengwei00:patch-6

Conversation

@zengwei00
Copy link
Copy Markdown

fix the Memory leak: nbuf

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

fix the Memory leak: nbuf
a12int_trace(A12_TRACE_SYSTEM, "kind=error:status=ENOMEM");
DYNAMIC_FREE(*next);
*next = NULL;
DYNAMIC_FREE(*nbuf);
Copy link
Copy Markdown

@ghost ghost 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
Copy Markdown

@ghost ghost 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.

1 participant