Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

[third-party][mongoose] fix the memory leak #14576

Merged
2 commits merged into from Dec 27, 2017
Merged

Conversation

bryonglodencissp
Copy link
Contributor

馃悰 label: hacktoberfest

Greetings,

Passing one pointer into realloc() and assigning the result directly into that same pointer variable can cause a memory leak if the reallocation fails, because the original allocation will still exist. The correct way to do this is to use a temporary pointer variable.

Signed-off-by: Bryon Gloden, CISSP庐 cissp@bryongloden.com

[src/mongoose/mongoose.c:2426]: (error) Common realloc mistake: 'entries' nulled but not freed upon failure

Found by https://github.com/bryongloden/cppcheck
@ariya
Copy link
Owner

ariya commented Oct 15, 2016

We just use Mongoose code as is. Have you tried to upstream the fix to the Mongoose project?
The reason is that we like to keep the third party code as unmodified as possible.

@zackw
Copy link
Collaborator

zackw commented Oct 15, 2016 via email

@ghost ghost requested a review from zackw December 21, 2017 10:34
@ghost ghost assigned zackw Dec 21, 2017
@ghost ghost added Bug Mongoose labels Dec 21, 2017
@ghost ghost merged commit 860ebdb into ariya:master Dec 27, 2017
ghost pushed a commit that referenced this pull request Dec 27, 2017
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants