Skip to content

Commit

Permalink
sprixel_auxiliary_vector: don't deref NULL on alloc failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 24, 2021
1 parent 9395245 commit 4064ede
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ uint8_t* sprixel_auxiliary_vector(const sprixel* s){
// for now we just do two bytes per pixel. we ought squeeze the transparency
// vector down to a bit per pixel, rather than a byte FIXME.
uint8_t* ret = malloc(sizeof(*ret) * pixels * 2);
memset(ret, 0, sizeof(*ret) * pixels);
if(ret){
memset(ret, 0, sizeof(*ret) * pixels);
}
return ret;
}

0 comments on commit 4064ede

Please sign in to comment.