dmitry          Fri Jul 13 09:15:04 2007 UTC

  Modified files:              
    /php-src/ext/soap   php_http.c 
  Log:
  Fixed memleak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.107&r2=1.108&diff_format=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.107 php-src/ext/soap/php_http.c:1.108
--- php-src/ext/soap/php_http.c:1.107   Mon May 28 23:43:24 2007
+++ php-src/ext/soap/php_http.c Fri Jul 13 09:15:03 2007
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_http.c,v 1.107 2007/05/28 23:43:24 iliaa Exp $ */
+/* $Id: php_http.c,v 1.108 2007/07/13 09:15:03 dmitry Exp $ */
 
 #include "php_soap.h"
 #include "ext/standard/base64.h"
@@ -284,6 +284,7 @@
                                request_size = Z_STRLEN(retval);
                        } else {
                                if (request != buf) {efree(request);}
+                               smart_str_free(&soap_headers_z);
                                return FALSE;
                        }
          }
@@ -305,6 +306,7 @@
          if (phpurl != NULL) {php_url_free(phpurl);}
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, 
NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -315,6 +317,7 @@
                php_url_free(phpurl);
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http 
and https are allowed.", NULL, NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -328,6 +331,7 @@
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "SSL support is not available 
in this build", NULL, NULL TSRMLS_CC);
                zend_alter_ini_entry("allow_url_fopen", 
sizeof("allow_url_fopen"), old_allow_url_fopen_list, 
strlen(old_allow_url_fopen_list), PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -381,6 +385,7 @@
                        if (request != buf) {efree(request);}
                        add_soap_fault(this_ptr, "HTTP", "Could not connect to 
host", NULL, NULL TSRMLS_CC);
                        zend_alter_ini_entry("allow_url_fopen", 
sizeof("allow_url_fopen"), old_allow_url_fopen_list, 
strlen(old_allow_url_fopen_list), PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
+                       smart_str_free(&soap_headers_z);
                        return FALSE;
                }
        }
@@ -437,7 +442,6 @@
                }
 
                smart_str_append(&soap_headers, &soap_headers_z);
-               smart_str_free(&soap_headers_z);
 
                if (soap_version == SOAP_1_2) {
                        smart_str_append_const(&soap_headers,"Content-Type: 
application/soap+xml; charset=utf-8");
@@ -690,12 +694,14 @@
                        client->stream = NULL;
                        client->use_proxy = 0;
                        add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP 
SOAP request", NULL, NULL TSRMLS_CC);
+                       smart_str_free(&soap_headers_z);
                        return FALSE;
                }
                smart_str_free(&soap_headers);
 
        } else {
                add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", 
NULL, NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -703,6 +709,7 @@
                php_stream_close(stream);
                client->stream = NULL;
                client->use_proxy = 0;
+               smart_str_free(&soap_headers_z);
                return TRUE;
        }
 
@@ -714,6 +721,7 @@
                        client->stream = NULL;
                        client->use_proxy = 0;
                        add_soap_fault(this_ptr, "HTTP", "Error Fetching http 
headers", NULL, NULL TSRMLS_CC);
+                       smart_str_free(&soap_headers_z);
                        return FALSE;
                }
 
@@ -867,6 +875,7 @@
                if (http_msg) {
                        efree(http_msg);
                }
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -1009,6 +1018,7 @@
                }
                if (auth) efree(auth);
        }
+       smart_str_free(&soap_headers_z);
 
        /* Check and see if the server even sent a xml document */
        content_type = get_http_header_value(http_headers,"Content-Type: ");

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to