Skip to content

Conversation

@ethomson
Copy link
Member

Add GIT_DEBUG_STRICT_ALLOC to help identify problematic callers of allocation code that pass a 0 size to the allocators and then expect a non-NULL return.

When given a 0-size allocation, malloc may return either a NULL or a pointer that is not writeable. Most systems return a non-NULL pointer; AIX is an outlier. We should be able to cope with this AIXy behavior, so this adds an option to emulate it.

ethomson added 4 commits July 19, 2021 15:41
Add `GIT_DEBUG_STRICT_ALLOC` to help identify problematic callers of
allocation code that pass a `0` size to the allocators and then expect a
non-`NULL` return.

When given a 0-size allocation, `malloc` _may_ return either a `NULL`
_or_ a pointer that is not writeable.  Most systems return a non-`NULL`
pointer; AIX is an outlier.  We should be able to cope with this AIXy
behavior, so this adds an option to emulate it.
@ethomson
Copy link
Member Author

Fixes #5714

Co-authored-by: lhchavez <lhchavez@lhchavez.com>
@ethomson ethomson merged commit 5c5c19a into main Jul 20, 2021
@ethomson ethomson deleted the ethomson/strict_alloc branch July 30, 2021 15:11
@boretrk boretrk mentioned this pull request Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants