#28883 [Opn->Fbk]: [PATCH] fix for crash during module shutdown
| From: | sniper@php.net | Date: | Thu, 03 Feb 2005 04:04:09 +0000 |
| Subject: | #28883 [Opn->Fbk]: [PATCH] fix for crash during module shutdown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73346@lists.php.net to get a copy of this message | ||
ID: 28883
Updated by: sniper@php.net
Reported By: novicky at aarongroup dot cz
-Status: Open
+Status: Feedback
Bug Type: Informix related
Operating System: All
PHP Version: 4.3.7
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2004-06-22 19:08:12] novicky at aarongroup dot cz
Description:
------------
There is a problem in function ifx_do_close which can lead to crash
during module shutdown.
The function ifx_do_close is called during shutdown from list
destrucors _close_ifx_link and _close_ifx_plink. If something goes
wrong in this function, error reporting is performed and emalloc is
called. Calling emalloc is not possible during memory destruction and
can cause segfault.
It is necessary to remove all error reporting from ifx_do_close (which
is in fact useless).
Here is a patch:
--- ifx.ec.orig 2004-06-01 02:52:14.000000000 +0200
+++ ifx.ec 2004-06-22 18:46:01.000000000 +0200
@@ -295,7 +295,6 @@
PARAMETER char *link;
EXEC SQL END DECLARE SECTION;
{
- char *ifx_err = NULL;
TSRMLS_FETCH();
EXEC SQL SET CONNECTION :link;
@@ -310,32 +309,12 @@
if (ifx_check() == 0) {
/* DISCONNECT again, after rollback */
EXEC SQL DISCONNECT :link;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s
after Automatic Rollback fails (%s)", link, (ifx_err =
ifx_error(link)));
}
- }
- if (ifx_check() < 0) {
+ else if (ifx_check() < 0) {
/* CLOSE database if rollback or disconnect fails */
EXEC SQL CLOSE DATABASE;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails
%s (%s)", link, (ifx_err = ifx_error(link)));
- }
}
}
- else if (SQLCODE < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s
fails (%s)", link, (ifx_err = ifx_error(link)));
- }
- }
- else {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails
(%s)", link, (ifx_err = ifx_error(link)));
- }
-
- if (ifx_err) {
- efree(ifx_err);
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28883&edit=1