stb_image_write: handle malloc failure in zlib

pull/538/head
Sean Barrett 2018-01-29 08:03:56 -08:00
parent 4fd9019c0f
commit 445473bdb5
1 changed files with 2 additions and 0 deletions

View File

@ -817,6 +817,8 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l
int i,j, bitcount=0;
unsigned char *out = NULL;
unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**));
if (hash_table == NULL)
return NULL;
if (quality < 5) quality = 5;
stbiw__sbpush(out, 0x78); // DEFLATE 32K window