From: Dmitry Stogov Date: Mon, 26 Jan 2004 16:20:19 +0000 (+0000) Subject: fix: memory leaks X-Git-Tag: php-5.0.0b4RC1~293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd773c92cb4bbf7fdd4905379611d5d61666f7ec;p=php fix: memory leaks --- 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) {