Skip to content

Commit d6ef39e

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Fix intermittent segfault in GD library
2 parents 5d6e702 + 55393e2 commit d6ef39e

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
@@ -160,7 +160,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
160160
RETURN_FALSE;
161161
}
162162
} else {
163-
ctx = emalloc(sizeof(gdIOCtx));
163+
ctx = ecalloc(1, sizeof(gdIOCtx));
164164
ctx->putC = _php_image_output_putc;
165165
ctx->putBuf = _php_image_output_putbuf;
166166
ctx->gd_free = _php_image_output_ctxfree;
@@ -173,7 +173,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
173173
}
174174

175175
if (!ctx) {
176-
ctx = emalloc(sizeof(gdIOCtx));
176+
ctx = ecalloc(1, sizeof(gdIOCtx));
177177
ctx->putC = _php_image_stream_putc;
178178
ctx->putBuf = _php_image_stream_putbuf;
179179
if (close_stream) {

0 commit comments

Comments
 (0)