From: Michael Wallner Date: Mon, 28 Jul 2014 20:39:28 +0000 (+0200) Subject: save a funccall X-Git-Tag: RELEASE_2_1_0_RC1~15 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=b9a4b15fdf74371c7dfb01b201b7c314f55fc050;p=m6w6%2Fext-http save a funccall --- diff --git a/php_http_buffer.c b/php_http_buffer.c index 35155e7..8ccee08 100644 --- a/php_http_buffer.c +++ b/php_http_buffer.c @@ -103,7 +103,7 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_shrink(php_http_buffer_t *buf) PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf, const char *append, size_t append_len) { - if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, append_len)) { + if (buf->free < append_len && PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, append_len)) { return PHP_HTTP_BUFFER_NOMEM; } memcpy(buf->data + buf->used, append, append_len); @@ -160,7 +160,7 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_cut(php_http_buffer_t *buf, size_t of PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_fix(php_http_buffer_t *buf) { - if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize_ex(buf, 1, 1, 0)) { + if (buf->free < 1 && PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize_ex(buf, 1, 1, 0)) { return NULL; } buf->data[buf->used] = '\0';