This rule finds delete expressions whose argument is a pointer that points to memory allocated using the malloc function, and calls to free whose argument is a pointer that points to memory allocated using the new operator. Behavior in such cases is undefined and should be avoided.

Use the delete operator when freeing memory allocated with new, and the free function when freeing memory allocated with malloc.

  • isocpp.org 'Standard C++', "Can I free() pointers allocated with new? Can I delete pointers allocated with malloc()?"
  • Wikipedia, "Relation to malloc and free" in new and delete (C++).