*** glibc detected *** ./client: double free or corruption (!prev): 0x09385098 ***

1. 遇到一个问题,程序执行时如下:

*** glibc detected *** ./test: free(): invalid pointer: 0x085d700b ***

free报错:查了一下原来是------越界了!!!

#include #include char * my_malloc() { char * temp = NULL; temp = (char*)malloc(sizeof(char)); //temp += 3; return temp; } int my_free() { char * test = NULL; test = my_malloc(); free(test); } int main(void) { my_free(); printf("free over!/n"); }

 

你可能感兴趣的:(系统编程)