Skip to content

Commit d88aaf5

Browse files
committed
zlib: no need to free dict on inflate init error
This was introduced in b0ef5fc because it added `efree(dict)` to both inflate and deflate error handling. But this is only necessary for the deflate case, not the inflate case (as also shown in the original leak report).
1 parent 3064540 commit d88aaf5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ext/zlib/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ PHP_FUNCTION(inflate_init)
908908
}
909909

910910
if (inflateInit2(&ctx->Z, encoding) != Z_OK) {
911-
efree(dict);
911+
/* dict is stored in the ctx in the object and will thus be freed by zval_ptr_dtor(). */
912912
zval_ptr_dtor(return_value);
913913
php_error_docref(NULL, E_WARNING, "Failed allocating zlib.inflate context");
914914
RETURN_FALSE;

0 commit comments

Comments
 (0)