mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
auxvec: unite memory release in sprite_rebuild() #1440
This commit is contained in:
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…
Reference in New Issue
Block a user