#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
char ptr[10] = {};
memcpy(ptr, NULL, 0);
void * ptr = malloc(sizeof(100));
return 0;
}
x03430-a@x03430-a:~/test/mem$ cppcheck mem_test.c
Checking mem_test.c ...
[mem_test.c:10]: (error) Memory leak: ptr
[mem_test.c:8]: (error) Null pointer dereference