pending = (pending ? realloc(pending, pendsize) : malloc(pendsize));
pending = (pending ? srealloc(pending, pendsize) : smalloc(pendsize));
void from_backend(int is_stderr, char *data, int datalen) {    unsigned char *p = (unsigned char *)data;    unsigned len = (unsigned)datalen;    /*     * stderr data is just spouted to local stderr and otherwise     * ignored.     */    if (is_stderr) {	fwrite(data, 1, len, stderr);	return;    }    inbuf_head = 0;    /*     * If this is before the real session begins, just return.     */    if (!outptr)        return;    if (outlen > 0) {        unsigned used = outlen;        if (used > len) used = len;        memcpy(outptr, p, used);        outptr += used; outlen -= used;        p += used; len -= used;    }    if (len > 0) {        if (pendsize < pendlen + len) {            pendsize = pendlen + len + 4096;            pending = (pending ? realloc(pending, pendsize) :                       malloc(pendsize));            if (!pending)                fatalbox("Out of memory");        }        memcpy(pending+pendlen, p, len);        pendlen += len;    }}