summaryrefslogtreecommitdiff
path: root/ext/soap/php_encoding.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2004-01-26 16:20:19 +0000
committerDmitry Stogov <dmitry@php.net>2004-01-26 16:20:19 +0000
commitfd773c92cb4bbf7fdd4905379611d5d61666f7ec (patch)
tree180c3e7e48a0446fc5ed07199ffc835a67d19afa /ext/soap/php_encoding.c
parent9387d78fd05771971d3831ab45f52b1945fd3ed0 (diff)
downloadphp-git-fd773c92cb4bbf7fdd4905379611d5d61666f7ec.tar.gz
fix: memory leaks
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r--ext/soap/php_encoding.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 0eaad5bbec..5ba17eb9fc 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -452,13 +452,9 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style)
zval_dtor(&tmp);
}
- pstr = malloc(new_len + 1);
- memcpy(pstr, str, new_len);
- pstr[new_len] = '\0';
+ xmlNodeSetContentLen(ret, str, new_len);
efree(str);
- xmlNodeSetContentLen(ret, pstr, new_len);
-
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
@@ -1975,10 +1971,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
xmlNodeSetContent(xmlParam, buf);
efree(buf);
} else if (Z_TYPE_P(data) == IS_STRING) {
- buf = malloc(Z_STRLEN_P(data)+1);
- strcpy(buf, Z_STRVAL_P(data));
-
- xmlNodeSetContentLen(xmlParam, buf, Z_STRLEN_P(data));
+ xmlNodeSetContentLen(xmlParam, Z_STRVAL_P(data), Z_STRLEN_P(data));
}
if (style == SOAP_ENCODED) {