state->data->allocated = XPT_GROW_CHUNK;
state->pools[i]->count = 0; state->pools[i]->bit = 0; if (mode == XPT_DECODE) { state->pools[i]->data = data; state->pools[i]->allocated = len; } else { state->pools[i]->data = PR_MALLOC(XPT_GROW_CHUNK); if (!state->pools[i]->data) { PR_FREE(state->pools[i]); if (i) { PR_FREE(state->pools[0]->data); PR_FREE(state->pools[0]); } PR_FREE(state); return NULL; } state->pools[i]->allocated = XPT_GROW_CHUNK; }
XPT_NewXDRState(XPTMode mode, char *data, uint32 len){    XPTState *state;    state = PR_NEW(XPTState);    if (!state)        return NULL;    state->mode = mode;    state->pool = PR_NEW(XPTDatapool);    if (!state->pool) {        PR_FREE(state);        return NULL;    }    state->pool->count = 0;    state->pool->bit = 0;    if (mode == XPT_DECODE) {        state->pool->data = data;        state->pool->allocated = len;    } else {        state->pool->data = PR_MALLOC(XPT_GROW_CHUNK);        if (!state->pool->data) {            PR_FREE(state->pool);            PR_FREE(state);            return NULL;        }        state->data->allocated = XPT_GROW_CHUNK;    }}