Skip to content

Commit

Permalink
fallin demo: no write to failed alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 24, 2021
1 parent 4064ede commit ce073d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/demo/fallin.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ int fallin_demo(struct notcurses* nc){
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
size_t usesize = sizeof(bool) * dimy * dimx;
bool* usemap = malloc(usesize);
if(usemap == NULL){
return -1;
}
memset(usemap, 0, usesize);
// brick size is relative to the screen size
const int maxx = dimx > 39 ? dimx / 10 : 2;
Expand Down

0 comments on commit ce073d2

Please sign in to comment.