nobbie          Thu Feb 27 04:00:56 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/ext/informix  ifx.ec 
  Log:
  - MFH: Segfault in ifx_errormsg()
  
  
Index: php4/ext/informix/ifx.ec
diff -u php4/ext/informix/ifx.ec:1.69.2.11 php4/ext/informix/ifx.ec:1.69.2.12
--- php4/ext/informix/ifx.ec:1.69.2.11  Tue Feb 25 02:09:09 2003
+++ php4/ext/informix/ifx.ec    Thu Feb 27 04:00:51 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: ifx.ec,v 1.69.2.11 2003/02/25 07:09:09 nobbie Exp $ */
+/* $Id: ifx.ec,v 1.69.2.12 2003/02/27 09:00:51 nobbie Exp $ */
 
 /* -------------------------------------------------------------------
  * if you want a function reference : "grep '^\*\*' ifx.ec" will give
@@ -1652,13 +1652,12 @@
 
        maxmsglen = 255;
        msglen = maxmsglen;     /* Some bug fix, rgetlmsg doesnt always set the value 
*/
-       ifx_errmsg = (char *)malloc(maxmsglen + 1);
+       ifx_errmsg = (char *)emalloc(maxmsglen + 1);
        if (ifx_errorcode != 0) {
                rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
                if (msglen > maxmsglen) {
-                       maxmsglen = msglen + 1;
-                       free(ifx_errmsg);
-                       ifx_errmsg = (char *)malloc(maxmsglen + 1);
+                       maxmsglen = msglen;
+                       ifx_errmsg = (char *)erealloc(ifx_errmsg, maxmsglen + 1);
                        rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
                }
        } else {
@@ -1667,7 +1666,7 @@
        
        returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128);
        sprintf(returnmsg, ifx_errmsg, sqlca.sqlerrm);
-       free(ifx_errmsg);
+       efree(ifx_errmsg);
        RETURN_STRING(returnmsg,0); 
 }
 /* }}} */



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

Reply via email to