]> granicus.if.org Git - php/commitdiff
Fixed memory leak
authorXinchen Hui <laruence@gmail.com>
Mon, 3 Mar 2014 08:13:03 +0000 (16:13 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 3 Mar 2014 08:13:03 +0000 (16:13 +0800)
ext/standard/url.c

index 1c02a1c437c5f118d70f7f42c5cec4e24b129f1d..33b70569aea4e389f4605a64eac94fb391a3b8d6 100644 (file)
@@ -654,19 +654,19 @@ PHP_FUNCTION(rawurlencode)
    Decodes URL-encodes string */
 PHP_FUNCTION(rawurldecode)
 {
-       char *in_str, *out_str;
-       int in_str_len, out_str_len;
+       char *in_str;
+       int in_str_len;
+       zend_string *out_str;
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in_str,
                                                          &in_str_len) == FAILURE) {
                return;
        }
 
-       out_str = estrndup(in_str, in_str_len);
-       out_str_len = php_raw_url_decode(out_str, in_str_len);
+       out_str = STR_INIT(in_str, in_str_len, 0);
+       out_str->len = php_raw_url_decode(out_str->val, out_str->len);
 
-//???    RETURN_STRINGL(out_str, out_str_len, 0);
-    RETURN_STRINGL(out_str, out_str_len);
+    RETURN_STR(out_str);
 }
 /* }}} */