Skip to content

Conversation

@ashamedbit
Copy link

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 :)

@suntong
Copy link
Contributor

suntong commented Aug 10, 2024

LGTM, @neurobin?

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