Skip to content

Commit 55393e2

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fix intermittent segfault in GD library
2 parents 722375c + e56fe7e commit 55393e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/gd/gd_ctx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
152152
RETURN_FALSE;
153153
}
154154
} else {
155-
ctx = emalloc(sizeof(gdIOCtx));
155+
ctx = ecalloc(1, sizeof(gdIOCtx));
156156
ctx->putC = _php_image_output_putc;
157157
ctx->putBuf = _php_image_output_putbuf;
158158
ctx->gd_free = _php_image_output_ctxfree;
@@ -165,7 +165,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
165165
}
166166

167167
if (!ctx) {
168-
ctx = emalloc(sizeof(gdIOCtx));
168+
ctx = ecalloc(1, sizeof(gdIOCtx));
169169
ctx->putC = _php_image_stream_putc;
170170
ctx->putBuf = _php_image_stream_putbuf;
171171
if (close_stream) {

0 commit comments

Comments
 (0)