指针使用R-1-3-8强制

禁止动态分配的指针变量未检查即使用

未检查即使用
test.c
1#include <stdlib.h>
2
3void foo(void)
4{
5 int *p = (int*) malloc(sizeof(int));
6 *p = 1;
禁止动态分配的指针变量未检查即使用 [gjb8114-r-1-3-8]
7}
判别 NULL 后使用
test.c
1#include <stdlib.h>
2
3void foo(void)
4{
5 int *p = (int*) malloc(sizeof(int));
6 if (p != NULL)
7 {
8 *p = 1;
9 }
10}