example.c:920:16: warning: dereference of possibly-NULL ‘head’ [CWE-690] [-Wanalyzer-possible-null-dereference]
920 | head->text = 1;
| ~~~~~~~~~~~^~~
‘test_deflate_set_header’: event 1
|
| 906 | PREFIX(gz_header) *head = calloc(1, sizeof(PREFIX(gz_header)));
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) this call could return NULL
size_t len = strlen(hello)+1;
+ if (head == NULL) {
+ printf("out of memory\n");
+ exit(1);
+ }
+
c_stream.zalloc = zalloc;
c_stream.zfree = zfree;
c_stream.opaque = (voidpf)0;