wez             Mon Feb 10 07:33:14 2003 EDT

  Modified files:              
    /php4/ext/rpc/com   com.c com_wrapper.c 
  Log:
  Error reporting leaks and cleanup
  
Index: php4/ext/rpc/com/com.c
diff -u php4/ext/rpc/com/com.c:1.16 php4/ext/rpc/com/com.c:1.17
--- php4/ext/rpc/com/com.c:1.16 Sun Feb  9 16:40:12 2003
+++ php4/ext/rpc/com/com.c      Mon Feb 10 07:33:14 2003
@@ -495,7 +495,7 @@
        VARIANT *variant_args;
        VARIANT result;
        int current_arg, current_variant;
-       char *ErrString;
+       char *ErrString = NULL;
        TSRMLS_FETCH();
 
        /* if the length of the name is 0, we are dealing with a pointer to a dispid */
@@ -552,7 +552,7 @@
 
 static int com_get(rpc_string property_name, zval *return_value, void **data)
 {
-       char *ErrString;
+       char *ErrString = NULL;
        VARIANT *result;
        OLECHAR *propname;
        DISPID dispid;
@@ -610,7 +610,7 @@
        DISPID dispid, mydispid = DISPID_PROPERTYPUT;
        DISPPARAMS dispparams;
        VARIANT *var;
-       char *error_message, *ErrString;
+       char *error_message, *ErrString = NULL;
        TSRMLS_FETCH();
 
        /* obtain property handler */
Index: php4/ext/rpc/com/com_wrapper.c
diff -u php4/ext/rpc/com/com_wrapper.c:1.86 php4/ext/rpc/com/com_wrapper.c:1.87
--- php4/ext/rpc/com/com_wrapper.c:1.86 Sun Feb  9 16:40:12 2003
+++ php4/ext/rpc/com/com_wrapper.c      Mon Feb 10 07:33:14 2003
@@ -18,7 +18,7 @@
    |         Wez Furlong <[EMAIL PROTECTED]>                           |
    +----------------------------------------------------------------------+
  */
-/* $Id: com_wrapper.c,v 1.86 2003/02/09 21:40:12 wez Exp $ */
+/* $Id: com_wrapper.c,v 1.87 2003/02/10 12:33:14 wez Exp $ */
 /*
  * This module implements support for COM components that support the IDispatch
  * interface.  Both local (COM) and remote (DCOM) components can be accessed.
@@ -125,8 +125,7 @@
                                                
SysFreeString(ExceptInfo.bstrDescription);
                                        }
                                        
-                                       *ErrString = emalloc(srclen+desclen+50);
-                                       zend_sprintf(*ErrString, "<b>Source</b>: %s 
<b>Description</b>: %s", src, desc);
+                                       spprintf(ErrString, 0, "<b>Source</b>: %s 
+<b>Description</b>: %s", src, desc);
                                        efree(src);
                                        efree(desc);
                                        
@@ -138,8 +137,7 @@
                                break;
                        case DISP_E_PARAMNOTFOUND:
                        case DISP_E_TYPEMISMATCH:
-                               *ErrString = emalloc(25);
-                               sprintf(*ErrString, "<b>Argument</b>: %d", 
pDispParams->cArgs-ArgErr+1);
+                               spprintf(ErrString, 0, "<b>Argument</b>: %d", 
+pDispParams->cArgs-ArgErr+1);
                                break;
                }
        }
@@ -247,7 +245,7 @@
 
 ZEND_API char *php_COM_error_message(HRESULT hr)
 {
-       void *pMsgBuf;
+       void *pMsgBuf = NULL;
 
        if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
FORMAT_MESSAGE_FROM_SYSTEM, NULL,
                                           hr, MAKELANGID(LANG_NEUTRAL, 
SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL)) {



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

Reply via email to