free(): invalid next size (normal) on fclose. But not when Valgrind runs [duplicate]

南笙酒味 提交于 2019-12-04 16:29:39

This code is the victim, you need to find the perpetrator. When you call fclose, some structure is freed. At that point, the code discovers that the free pool is corrupt and reports an error. However, it's some other chunk of code that corrupted the free pool, not this code.

The most common causes of this error are freeing the same block of memory twice and accessing a block of memory after you've freed it. It's strange that valgrind wasn't able to catch this, since these are exactly the kind of errors it usually catches.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!