mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
c8953d1b48
Add a zero check to the function `event_mm_malloc_', i.e. simply return NULL if the sz argument is zero. On failure, set errno to ENOMEM and return NULL. Add a zero check to the function `event_mm_calloc_', i.e. simply return NULL if either argument is zero. Also add an unsigned integer multiplication check, and if an integer overflow would occur, set errno to ENOMEM and return NULL. On failure, set errno to ENOMEM and return NULL. Add a NULL check to the function `event_mm_strdup_', i.e. set errno to EINVAL and return NULL. Also add an unsigned integer addition check, and if an integer overflow would occur, set errno to ENOMEM and return NULL. If a memory allocation error occurs, again set errno to ENOMEM and return NULL. Add unit tests to `test/regress_util.c'.