mirror of
https://github.com/nothings/stb
synced 2024-12-15 12:22:55 +03:00
stb_image_write: handle malloc failure in zlib
This commit is contained in:
parent
4fd9019c0f
commit
445473bdb5
@ -817,6 +817,8 @@ unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, int *out_l
|
|||||||
int i,j, bitcount=0;
|
int i,j, bitcount=0;
|
||||||
unsigned char *out = NULL;
|
unsigned char *out = NULL;
|
||||||
unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**));
|
unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**));
|
||||||
|
if (hash_table == NULL)
|
||||||
|
return NULL;
|
||||||
if (quality < 5) quality = 5;
|
if (quality < 5) quality = 5;
|
||||||
|
|
||||||
stbiw__sbpush(out, 0x78); // DEFLATE 32K window
|
stbiw__sbpush(out, 0x78); // DEFLATE 32K window
|
||||||
|
Loading…
Reference in New Issue
Block a user