Versions Compared

Key

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

...

Code Block
#define MIN_SIZE_ALLOWED 10

void func2(int *list, size_t list_size) {
  if (size < MIN_SIZE_ALLOWED) {
     /* Handle Error Condition */
      return;
  }
  /* Process list */
}

int func1 (size_t number) {
  int *list = malloc (number * sizeof(int));
  if (list == NULL) {
    /* Handle Allocation Error */
  }
  func2(list,number);

  /* Continue Processing list */

  free(list);
}

References

Wiki Markup
 [Seacord 05|C References#Seacord 05] Chapter 4 Dynamic Memory
Management
Wiki Markup
 Management
 Consistent Memory Management Conventions, Dan Plakosh,  https://buildsecurityin.us-cert.gov/daisy/bsi/articles/knowledge/coding/476.html
 MIT Kerberos 5 \[http://web.mit.edu/kerberos/advisories/MITKRB5-SA-2004-002-dblfree.txt