MFC r300624:
Fix up r300385
I accidentally glossed over the fact that tmp is manipulated via strchr, so
if we tried to free tmp after r300385, it would have crashed.
Create a separate pointer (tmp2) to track the original allocation of tmp,
and free tmp2 if p->nc_lookups can't be malloced
CID: 1356026