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

Lots of memory leaks #50

Open
scamacho23 opened this issue Aug 31, 2020 · 6 comments
Open

Lots of memory leaks #50

scamacho23 opened this issue Aug 31, 2020 · 6 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed up-for-grabs Submit a pull request. This needs work! URGENT ASAP

Comments

@scamacho23
Copy link
Owner

🐛 Describe the bug

Liszt has some memleak issues:

  • whenever scanf is used, valgrind reports that Liszt leaks some memory (this one may be a stdio issue)
  • whenever wordfree is used, valgrind reports two memory leaks
  • the commands -clar and -cln have a number of memleak errors, notably invalid read sizes and invalid frees
  • the commands -ln and -lar have a number of memory leaks

💣 Steps to reproduce

Use the commands with valgrind to see what happens.

@scamacho23 scamacho23 added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers up-for-grabs Submit a pull request. This needs work! URGENT ASAP labels Aug 31, 2020
@scamacho23 scamacho23 self-assigned this Aug 31, 2020
@scamacho23 scamacho23 changed the title Request user permission has memory leaks Lots of memory leaks Aug 31, 2020
@Bwoltz
Copy link
Contributor

Bwoltz commented Sep 14, 2020

Here's the results from Valgrind using the following command:
valgrind --leak-check=full ./lst -cln

==5067==
==5067== HEAP SUMMARY:
==5067== in use at exit: 151 bytes in 3 blocks
==5067== total heap usage: 26 allocs, 23 frees, 40,586 bytes allocated
==5067==
==5067== Searching for pointers to 3 not-freed blocks
==5067== Checked 69,960 bytes
==5067==
==5067== 34 bytes in 1 blocks are definitely lost in loss record 1 of 3
==5067== at 0x4C31D2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5067== by 0x10AE33: print (in liszt/liszt/lst)
==5067== by 0x10AF53: cJSON_PrintUnformatted (in liszt/liszt/lst)
==5067== by 0x10EAA7: getCurrentNotePath (in liszt/liszt/lst)
==5067== by 0x10E966: getCurrentNote (in liszt/liszt/lst)
==5067== by 0x1116EB: clearNotes (in liszt/liszt/lst)
==5067== by 0x11288B: main (in liszt/liszt/lst)
==5067==
==5067== 117 (16 direct, 101 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==5067== at 0x4C31D2F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5067== by 0x4F49790: w_addword (wordexp.c:176)
==5067== by 0x4F49790: wordexp (wordexp.c:2425)
==5067== by 0x11180E: clearNotes (in liszt/liszt/lst)
==5067== by 0x11288B: main (in liszt/liszt/lst)
==5067==
==5067== LEAK SUMMARY:
==5067== definitely lost: 50 bytes in 2 blocks
==5067== indirectly lost: 101 bytes in 1 blocks
==5067== possibly lost: 0 bytes in 0 blocks
==5067== still reachable: 0 bytes in 0 blocks
==5067== suppressed: 0 bytes in 0 blocks
==5067==
==5067== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
==5067== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

"Loss record 1 of 3" seems to be referring to the getCurrentNodePath() function in helper.c

@scamacho23
Copy link
Owner Author

Yes! Thanks for sharing. I currently don't have the bandwidth to fix this, but I'd invite you to take wack at it because it's definitely an issue.

@Bwoltz
Copy link
Contributor

Bwoltz commented Sep 14, 2020

Yea, I'll give it a shot

@Bwoltz
Copy link
Contributor

Bwoltz commented Sep 15, 2020

Submitted a pull request

@scamacho23
Copy link
Owner Author

Thanks! Looks great. I only found those four commands to have leaks (although I admittedly checked through a while ago). Some others may have cropped up in the meantime (if you have the energy to look through -- once again, very very appreciated).

@MatthewC MatthewC mentioned this issue Dec 27, 2022
6 tasks
@cscortes
Copy link

This is still marked open, did you need help. I was thinking I could run some SAST tools to see if I could find anything? Let me know, otherwise maybe mark it as closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed up-for-grabs Submit a pull request. This needs work! URGENT ASAP
Projects
None yet
Development

No branches or pull requests

3 participants