projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
coverity fixes
[m6w6/ext-http]
/
src
/
php_http_buffer.c
diff --git
a/src/php_http_buffer.c
b/src/php_http_buffer.c
index eaebfa03e7e3e477fc97ccecd907b7b1169d716f..64e559a5907f0c8a051d350d3511f8863fa9a683 100644
(file)
--- a/
src/php_http_buffer.c
+++ b/
src/php_http_buffer.c
@@
-32,9
+32,13
@@
PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t
PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_buffer_t *buf, const char *string, size_t length)
{
PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_buffer_t *buf, const char *string, size_t length)
{
+ int free_buf = !!buf;
+
if ((buf = php_http_buffer_init(buf))) {
if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, string, length)) {
if ((buf = php_http_buffer_init(buf))) {
if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, string, length)) {
- pefree(buf, buf->pmem);
+ if (free_buf) {
+ pefree(buf, buf->pmem);
+ }
buf = NULL;
}
}
buf = NULL;
}
}