Commit c8953d1b4863e7484bf0afb42758644a16004cb9

Mansour Moufid 2011-10-14T17:16:03

Add argument checks to some memory functions in `event.c'. 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'.