memory corruption

前端 未结 7 1032
佛祖请我去吃肉
佛祖请我去吃肉 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:40

    freeing already freed memory, leads to undefined behavior, you got lucky, in this case, on other times you might get your core-dump

提交回复
热议问题