Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2012-Dir-4.7_a

In this section:
Synopsis

(Required) If a function returns error information, then that error information shall be tested.

Enabled by default

No

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Returned error information should be tested.

Coding standards
CWE 252

Unchecked Return Value

MISRA C:2012 Dir-4.7

(Required) If a function returns error information, then that error information shall be tested

Code examples

The following code example fails the check and will give a warning:

void example(void) {
  malloc(5);
}

The following code example passes the check and will not give a warning about this issue:

void example() {
  int p = malloc(5);
}