-
|
A second group of test errors on the AIX port concerns ''out of memory'' diagnostics for As seen in the stack traces, functions stdalloc__reallocarray() and stdalloc__calloc() are being called with nelem equals zero and the resulting malloc(0), calloc(0, n), etc on AIX return a null pointer. This behaviour is allowed by the POSIX/UNIX standard. A work around patch (test if zero, set to 1) for the first two test errors in network::remote is : For test error(s) in stash::apply the work around involves several places where alloc(zero) is encountered. The patch for stash::apply::uses_reflog_like_indices_2 is threefold : |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Wouldn't it make more sense to handle this inside Handling this inside the allocator macros (in |
Beta Was this translation helpful? Give feedback.
-
I would argue that these aren't workarounds, libgit2 is simply behaving wrong. Now since we have pluggable allocators now, we could define our interface with those allocators as requiring them to support However, instead of trying to allocate non-zero, I think that my preference would be to simply not call the allocator. Personally, I think that this is much more readable: git_pobject **wo = NULL;
if (pb->nr_objects && (wo = git__mallocarray(pb->nr_objects, sizeof(*wo))) == NULL)
return NULL;
/* do some work, making sure that we guard based on pb->nr_objects */
git__free(wo); |
Beta Was this translation helpful? Give feedback.
-
|
This is late, but |
Beta Was this translation helpful? Give feedback.
-
|
This should be fixed by #5951 |
Beta Was this translation helpful? Give feedback.
This should be fixed by #5951