Fix memory leaks in write_c and eval_shell#165
Open
ashamedbit wants to merge 1 commit intoneurobin:masterfrom
Open
Fix memory leaks in write_c and eval_shell#165ashamedbit wants to merge 1 commit intoneurobin:masterfrom
ashamedbit wants to merge 1 commit intoneurobin:masterfrom
Conversation
Contributor
|
LGTM, @neurobin? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I am a new contributor looking forward to contribute to the shc project :).
I came across the following open issue here #155
It is a leaksanitizer report which detects a leak that happens on passing a simple bash script.
I was able to reproduce the bug on running a custom shell script and was able to generate a patch for it. The leak happens within function write_c. Basically all the allocated variables in this function including msg1, msg2, chk1, chk2, tst1, tst2 and name need to be freed after allocation. I have a model patch and I was wondering if I can merge the same.
I was able to verify that after the patch, the leak no longer occurs through leaksanitizer (and there is no double free for that matter)
In addition I have also patched a leak that I encountered when running on an invalid bash script. This new leak happens in eval_shell function when an invalid first line on script is encountered. Here ptr is allocated but not freed before the abrupt exit.
Let me know if this is a good patch! If not let me know what changes need be done. I am eager to become a regular contributor to this repository :)