sfree(term->post_bidi_cache[line].forward); sfree(term->post_bidi_cache[line].backward);
static void term_bidi_cache_store(Terminal *term, int line, termchar *lbefore,				  termchar *lafter, bidi_char *wcTo,				  int width){    int i;    if (!term->pre_bidi_cache || term->bidi_cache_size <= line) {	int j = term->bidi_cache_size;	term->bidi_cache_size = line+1;	term->pre_bidi_cache = sresize(term->pre_bidi_cache,				       term->bidi_cache_size,				       struct bidi_cache_entry);	term->post_bidi_cache = sresize(term->post_bidi_cache,					term->bidi_cache_size,					struct bidi_cache_entry);	while (j < term->bidi_cache_size) {	    term->pre_bidi_cache[j].chars =		term->post_bidi_cache[j].chars = NULL;	    term->pre_bidi_cache[j].width =		term->post_bidi_cache[j].width = -1;	    j++;	}    }    sfree(term->pre_bidi_cache[line].chars);    sfree(term->post_bidi_cache[line].chars);    term->pre_bidi_cache[line].width = width;    term->pre_bidi_cache[line].chars = snewn(width, termchar);    term->post_bidi_cache[line].width = width;    term->post_bidi_cache[line].chars = snewn(width, termchar);    term->post_bidi_cache[line].forward = snewn(width, int);    term->post_bidi_cache[line].backward = snewn(width, int);    memcpy(term->pre_bidi_cache[line].chars, lbefore, width * TSIZE);    memcpy(term->post_bidi_cache[line].chars, lafter, width * TSIZE);    memset(term->post_bidi_cache[line].forward, 0, width * sizeof(int));    memset(term->post_bidi_cache[line].backward, 0, width * sizeof(int));    for (i = 0; i < width; i++) {	int p = wcTo[i].index;	assert(0 <= p && p < width);	term->post_bidi_cache[line].backward[i] = p;	term->post_bidi_cache[line].forward[p] = i;    }}