...
Code Block | ||||
---|---|---|---|---|
| ||||
png_charp chunkdata; chunkdata = (png_charp)png_malloc(png_ptr, length + 1); if (chunkdata == NULL) { /* Handle Allocationallocation Errorerror */ } |
Noncompliant Code Example
...
Code Block | ||||
---|---|---|---|---|
| ||||
size_t size = strlen(input_str)+1; str = (char *)malloc(size); if (str == NULL) { /* Handle Allocationallocation Errorerror */ } memcpy(str, input_str, size); /* ... */ free(str); str = NULL; |
...
Tool | Version | Checker | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Compass/ROSE | Can detect violations of this rule. In particular, ROSE ensures that any pointer returned by | ||||||||||||||||||||||||||
|
| CHECKED_RETURN NULL_RETURNS REVERSE_INULL FORWARD_NULL | Finds instances where a pointer is checked against | ||||||||||||||||||||||||
Include Page | Coverity_V | Coverity_V | NULL_RETURNS | Identifies functions that can return a null pointer but are not checked. | Include Page | | Coverity_V | REVERSE_INULL | Identifies code that dereferences a pointer and then checks the pointer against | ||||||||||||||||||
Include Page | Coverity_V | Coverity_V | FORWARD_NULL | Can find the instances where | |||||||||||||||||||||||
Fortify SCA | 5.0 | ||||||||||||||||||||||||||
| NPD.* *RNPD.* | ||||||||||||||||||||||||||
| 45 D | Fully implemented. | |||||||||||||||||||||||||
PRQA QA-C |
| 0504 | Fully implemented. | ||||||||||||||||||||||||
Splint |
|
...