I think you should read the above as:
memset(p, '\0', 10);
Probably best approach is to always use calloc, unless you fill the buffer yourself with other meaningful values immediately after allocation.