memory corruption

前端 未结 7 1034
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 19:31

i was running a small c program:

#include
int main()
{
char *p;
p = (char *)malloc(10);
free(p);
free(p);
free(p);
printf(\"\\npointer is freed!!\         


        
7条回答
  •  礼貌的吻别
    2021-01-21 19:52

    I would expect DEBUG builds of most compilers to be able to detect this type of a failure and report exactly what happened. So would MSVC do.

    In RELEASE, it could be optimized to generate unpredictable behavior faster.

提交回复
热议问题