Fix double free in psl_load_fp(), found by fuzzing

This commit is contained in:
Tim Rühsen 2017-06-09 22:53:19 +02:00
parent bce2e9acb0
commit 045bf63031
1 changed files with 2 additions and 0 deletions

View File

@ -1161,6 +1161,8 @@ psl_ctx_t *psl_load_fp(FILE *fp)
/* release unused memory */ /* release unused memory */
if ((m = realloc(psl->dafsa, len))) if ((m = realloc(psl->dafsa, len)))
psl->dafsa = m; psl->dafsa = m;
else if (!len)
psl->dafsa = NULL; // realloc() just free'd psl->dafsa
psl->dafsa_size = len; psl->dafsa_size = len;
psl->utf8 = !!GetUtfMode(psl->dafsa, len); psl->utf8 = !!GetUtfMode(psl->dafsa, len);