Check for size 0 when xmalloc'ing
If size is 0, it will allocate 0 + 2. 2 for the magic and the size. But xmalloc will then retun the pointer pointing past the newly allocated memory (p[2]) which can cause a segfault.
Please register or sign in to comment