egcpool_stash: exit on strdup() failure #624

This commit is contained in:
nick black 2020-06-03 04:44:13 -04:00
parent 96a47de845
commit e32e4d9744
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -127,7 +127,9 @@ egcpool_stash(egcpool* pool, const char* egc, size_t ulen){
do{ do{
if(egcpool_alloc_justified(pool, len) || searched){ if(egcpool_alloc_justified(pool, len) || searched){
if(!duplicated){ if(!duplicated){
duplicated = strdup(egc); if((duplicated = strdup(egc)) == NULL){
return -1;
}
} }
if(egcpool_grow(pool, len) && searched){ if(egcpool_grow(pool, len) && searched){
free(duplicated); free(duplicated);