]> granicus.if.org Git - php/commitdiff
fix: memory leaks
authorDmitry Stogov <dmitry@php.net>
Mon, 26 Jan 2004 16:20:19 +0000 (16:20 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 26 Jan 2004 16:20:19 +0000 (16:20 +0000)
ext/soap/php_encoding.c

index 0eaad5bbec98955c58bb3598d563d441fa054792..5ba17eb9fc8a2ffece32dd01b0247a4a55921840 100644 (file)
@@ -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) {