Please sign in to comment.
PetscMalloc: allow ptr=malloc(0) and free(ptr)
ISO C90 §7.10.3: "If the size of the space requested is zero, the behavior is implementation-defined; the value returned shall be either a null pointer or a unique pointer." We believe that ptr=malloc(0) and free(ptr) is now handled properly, so it's no longer necessary to short-circuit our PetscMalloc. This allows memory checking tools to match size-0 allocations and frees if they so choose.
- Loading branch information...
Showing with 9 additions and 12 deletions.