Fix memory leak in test example
This PR fixes a memory leak in the test.c example. Previously, an array allocated with malloc was not freed, causing 20 bytes of memory to remain allocated when the program exited.
Changes made:
Freed the allocated memory (ptr) before program exit to prevent the leak.
Verified using Dr. Memory that no memory leaks remain.
Verification:
Run ../build/bin/drmemory -- ./test to confirm no leaks reported.
Test compiled and ran successfully with gcc -g test.c -o test.
Impact:
This ensures proper memory management in the example code and prevents unnecessary memory leaks for users running the example.
Hi @maintainers 👋
I’ve submitted this small fix for a memory leak in the test example. The change frees the previously unfreed memory and has been verified using Dr. Memory.
Just checking in — please let me know if any updates or adjustments are needed. Thank you for reviewing!
Hi @maintainers 👋
I’ve submitted this small fix for a memory leak in the test example. The change frees the previously unfreed memory and has been verified using Dr. Memory.
Just checking in — please let me know if any updates or adjustments are needed. Thank you for reviewing!
Please see my question at https://github.com/DynamoRIO/drmemory/pull/2567#discussion_r2453878831
Looks like AI slop (see https://www.theregister.com/2024/12/10/ai_slop_bug_reports/ for example)