calloc() expects count first and the actual size to allocate as second argument. Say Thank You to smatch for finding this issues for us.