Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
size_t size = strlen(input_str)+1;
str = (char *) malloc(size);
memcpy(str, input_str, size);
/* ... */
free(str);
str = NULL; 

...

Code Block
bgColor#ccccff
size_t size = strlen(input_str)+1;
str = (char *) malloc(size);
if (str == NULL) {
  /* Handle Allocation Error */
}
memcpy(str, input_str, size);
/* ... */
free(str);
str = NULL; 

...

The LDRA tool suite V 7.6.0 is able to can detect violations of this rule.

Fortify SCA Version 5.0 is able to can detect violations of this rule.

...