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

LeakSanitizer: detected memory leaks #155

Open
yangfar opened this issue Aug 17, 2023 · 1 comment
Open

LeakSanitizer: detected memory leaks #155

yangfar opened this issue Aug 17, 2023 · 1 comment

Comments

@yangfar
Copy link

yangfar commented Aug 17, 2023

When I compiled shc in afl-gcc and fsanitize mode and converted sh to an executable file, I found a memory leak.
kn007/silk-v3-decoder@07bfa0f

Details:
fl-clang-fast 2.57b by [email protected]
afl-llvm-pass 2.57b by [email protected]
[+] Instrumented 82 locations (ASAN/MSAN mode, ratio 100%).

=================================================================
==61537==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 65 byte(s) in 1 object(s) allocated from:
#0 0x493e59 in realloc (/home/yzy/fuzzsoftware/shc/local/bin/shc+0x493e59)
#1 0x4c6385 in write_C /home/yzy/fuzzsoftware/shc/src/shc.c:1221:16
#2 0x4ca7d0 in do_all /home/yzy/fuzzsoftware/shc/src/shc.c:1348:6
#3 0x4cb11f in main /home/yzy/fuzzsoftware/shc/src/shc.c:1358:2

Direct leak of 44 byte(s) in 1 object(s) allocated from:
#0 0x493e59 in realloc (/home/yzy/fuzzsoftware/shc/local/bin/shc+0x493e59)
#1 0x4c82fa in write_C /home/yzy/fuzzsoftware/shc/src/shc.c:1246:16
#2 0x4ca7d0 in do_all /home/yzy/fuzzsoftware/shc/src/shc.c:1348:6
#3 0x4cb11f in main /home/yzy/fuzzsoftware/shc/src/shc.c:1358:2
Cmd:
./shc -f /home/root/shc/converter.sh -o converter
Ubuntu:
x86_64 x86_64 x86_64 GNU/Linux

Thanks!

@mdeweerd
Copy link

mdeweerd commented Jan 5, 2024

Also found by cppcheck:

src/shc.c(1033): error (memleak): Memory leak: ptr
src/shc.c(1088): error (memleak): Memory leak: text
src/shc.c(1037): error (memleakOnRealloc): Common realloc mistake: 'shll' nulled but not freed upon failure
src/shc.c(1065): error (memleakOnRealloc): Common realloc mistake: 'opts' nulled but not freed upon failure
src/shc.c(1090): error (memleakOnRealloc): Common realloc mistake: 'text' nulled but not freed upon failure
src/shc.c(1099): error (memleakOnRealloc): Common realloc mistake: 'text' nulled but not freed upon failure

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

No branches or pull requests

2 participants