问题
The following message gets generated after running my program under valgrind:
4 bytes in 1 blocks are definitely lost in loss record 1 of 11
==21938== at 0x4C2DD10: calloc (vg_replace_malloc.c:623)
==21938== by 0x401636: main (syntax.c:187)
That's the line of code where the leak was detected:
char *word = calloc(4, sizeof(char)); //syntax.c:187
I'm not understanding what's wrong with the code above. Why is valgrind generating an error?
来源:https://stackoverflow.com/questions/43967592/calloc-4-bytes-in-1-blocks-are-definitely-lost