check if resp == NULL and return ERROR_MEMORY if that's the case.