auxvec: unite memory release in sprite_rebuild() #1440

pull/1610/head
nick black 3 years ago committed by Nick Black
parent a6766c3bd4
commit 069084d435

@ -1001,15 +1001,15 @@ sprite_rebuild(const notcurses* nc, sprixel* s, int ycell, int xcell){
int ret = 0;
// special case the transition back to SPRIXCELL_TRANSPARENT; this can be
// done in O(1), since the actual glyph needn't change.
uint8_t* auxvec = s->n->tam[s->dimx * ycell + xcell].auxvector;
assert(auxvec);
if(s->n->tam[s->dimx * ycell + xcell].state == SPRIXCELL_ANNIHILATED_TRANS){
s->n->tam[s->dimx * ycell + xcell].state = SPRIXCELL_TRANSPARENT;
}else if(s->n->tam[s->dimx * ycell + xcell].state == SPRIXCELL_ANNIHILATED){
uint8_t* auxvec = s->n->tam[s->dimx * ycell + xcell].auxvector;
assert(auxvec);
// sets the new state itself
ret = nc->tcache.pixel_rebuild(s, ycell, xcell, auxvec);
free(auxvec);
}
free(auxvec);
s->n->tam[s->dimx * ycell + xcell].auxvector = NULL;
return ret;
}

@ -314,7 +314,6 @@ int kitty_rebuild(sprixel* s, int ycell, int xcell, uint8_t* auxvec){
//fprintf(stderr, "CLEARED ROW, TARGY: %d\n", targy - 1);
if(--targy == 0){
s->n->tam[s->dimx * ycell + xcell].state = state;
free(auxvec);
return 0;
}
thisrow = targx;

Loading…
Cancel
Save