运算处理R-1-6-17强制
禁止释放非最初分配地址的指针
释放非最初分配地址的指针
test.c
1#include <stdlib.h>23void foo(void)4{5 char *p = (char *)malloc(1);6 if (p)7 {8 p++;9 free(p);禁止释放非最初分配地址的指针 [gjb8114-r-1-6-17]10 }11}
释放最初分配地址的指针
test.c
1#include <stdlib.h>23void foo(void)4{5 char *p = (char *) malloc(1);6 if (p)7 {8 char* q = p;9 p++;10 free(q);11 }12}