Produce proper error messages if memory exhausted in strdup().