兄弟,你malloc出来才需要你去free
char guard[10]; 是局部变量字符数组 不是你malloc出来的
你最后还要 free(guard); 肯定会挂掉的
将 free(guard);删去
我查了下MSDN中有
The free function deallocates a memory block (memblock) that was previously allocated by a call to calloc, malloc, or realloc.
即free只能释放用calloc, malloc, realloc等函数分配的内存空间!
char guard[10];
显然guard不是!
最后free(guard)去掉
free(guard);
这个错了
这是数组,你能free?