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 some issues reported by Valgrind #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stweil
Copy link

@stweil stweil commented Jul 21, 2017

These commits fix two unrelated memory issues which were identified by Valgrind.
The duplicate free problem caused a crash and triggered my investigations.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869220.

@stweil stweil changed the title Fix uninitialized value Fix some issues reported by Valgrind Jul 21, 2017
Valgrind report:
==10379== Conditional jump or move depends on uninitialised value(s)
==10379==    at 0x125E62: agrep (sgrep.c:1161)
==10379==    by 0x12344B: sgrep (sgrep.c:436)
==10379==    by 0x119A29: exec (agrep.c:3430)
==10379==    by 0x119258: agrep_search (agrep.c:3226)
==10379==    by 0x119327: fileagrep_search (agrep.c:3262)
==10379==    by 0x119460: fileagrep (agrep.c:3312)
==10379==    by 0x11D136: main (main.c:79)
==10379==  Uninitialised value was created by a stack allocation
==10379==    at 0x125C24: agrep (sgrep.c:1105)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
There are calls of free_buf in all other code branches.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Copy link

@vixie vixie left a comment

Choose a reason for hiding this comment

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

lgtm.

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