Code:  xcalloc (size_t num, size_t size)
 {
    void *ptr = malloc(num * size);
     if (ptr)
     {
        memset (ptr, '\0', (num * size));
     }
     return ptr;
 }

Commit Message: Fix integer overflows and harden memory allocator.
CWE ID: CWE-190
 xcalloc (size_t num, size_t size)
 {
    size_t res;
    if (check_mul_overflow(num, size, &res))
        abort();

    void *ptr;
    ptr = malloc(res);
     if (ptr)
     {
        memset (ptr, '\0', (res));
     }
     return ptr;
 }
