Key*_*art 1 c valgrind memory-leaks
我有一个程序从文件中读取并将项目存储在队列中然后将它们打印出来.我从valgrind得到这个:
HEAP SUMMARY:
in use at exit: 302 bytes in 14 blocks
total heap usage: 30 allocs, 16 frees, 1,230 bytes allocated
302 bytes in 14 blocks are definitely lost in loss record 1 of 1
at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
by 0x372167FB41: strdup (strdup.c:43)
by 0x400A6A: addtoqueue(main.c:30)
by 0x400B5A: addfiletoqueue(main.c:45)
by 0x400C27: main (main.c:62)
LEAK SUMMARY:
definitely lost: 302 bytes in 14 blocks
indirectly lost: 0 bytes in 0 blocks
possibly lost: 0 bytes in 0 blocks
still reachable: 0 bytes in 0 blocks
suppressed: 0 bytes in 0 blocks
Run Code Online (Sandbox Code Playgroud)
main.c的第62行
addfiletoqueue (queue, argv[argi]);
Run Code Online (Sandbox Code Playgroud)
main.c的第45行
addtoqueue (queue, file, filename);
Run Code Online (Sandbox Code Playgroud)
main.c的第30行
readline = strdup (buffer);
assert (readline != NULL);
queue_add (queue, readline);
Run Code Online (Sandbox Code Playgroud)
我需要免费阅读吗?