]> granicus.if.org Git - php/commitdiff
update buffer size after having effectively realloc()ed it when appending
authorArnaud Le Blanc <lbarnaud@php.net>
Mon, 18 Aug 2008 03:54:49 +0000 (03:54 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Mon, 18 Aug 2008 03:54:49 +0000 (03:54 +0000)
data to an output buffer
# may caused some problems if erealloc() failed here because of memory
# limit ("memory limit exhausted" error message then written to
# the buffer, etc)

main/output.c

index b4067c41a6e3cd0662d998e27f5b016a9e1febe4..5a2b8641d39a2e440a4f0645f5b3c0cf8c1d2aee 100644 (file)
@@ -913,7 +913,8 @@ static inline int php_output_handler_append(php_output_handler *handler, const p
                        size_t grow_buf = PHP_OUTPUT_HANDLER_INITBUF_SIZE(buf->used - (handler->buffer.size - handler->buffer.used));
                        size_t grow_max = MAX(grow_int, grow_buf);
                        
-                       handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size += grow_max);
+                       handler->buffer.data = erealloc(handler->buffer.data, handler->buffer.size + grow_max);
+                       handler->buffer.size += grow_max;
                }
                memcpy(handler->buffer.data + handler->buffer.used, buf->data, buf->used);
                handler->buffer.used += buf->used;