hi, If it fixes a crash, please merge to 5.2. And also add a NEWS entry.
I wonder if you read you @php.net alias... :) On Sat, Nov 8, 2008 at 2:22 PM, Timm Friebe <[EMAIL PROTECTED]> wrote: > thekid Sat Nov 8 13:22:14 2008 UTC > > Modified files: (Branch: PHP_5_3) > /php-src/ext/sybase_ct php_sybase_ct.c > Log: > - Fixed problems with segmentation faults when using unbuffered queries > # Double-freeing results caused these > > http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.13.2.10&r2=1.103.2.5.2.13.2.11&diff_format=u > Index: php-src/ext/sybase_ct/php_sybase_ct.c > diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.10 > php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.11 > --- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.13.2.10 Sat Nov 8 > 12:24:52 2008 > +++ php-src/ext/sybase_ct/php_sybase_ct.c Sat Nov 8 13:22:14 2008 > @@ -18,7 +18,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13.2.10 2008/11/08 12:24:52 thekid Exp > $ */ > +/* $Id: php_sybase_ct.c,v 1.103.2.5.2.13.2.11 2008/11/08 13:22:14 thekid Exp > $ */ > > > #ifdef HAVE_CONFIG_H > @@ -273,6 +273,21 @@ > #define efree_n(x) { efree(x); x = NULL; } > #define efree_if(x) if (x) efree_n(x) > > +#ifdef PHP_SYBASE_DEBUG > +#define FREE_SYBASE_RESULT(result) > \ > + if (result) { > \ > + fprintf(stderr, "_free_sybase_result(%p) called from line #%d\n", > result, __LINE__); \ > + fflush(stderr); > \ > + _free_sybase_result(result); > \ > + result = NULL; > \ > + } > +#else > +#define FREE_SYBASE_RESULT(result) > \ > + if (result) { > \ > + _free_sybase_result(result); > \ > + result = NULL; > \ > + } > +#endif > static void _free_sybase_result(sybase_result *result) > { > int i, j; > @@ -326,7 +341,7 @@ > php_sybase_finish_results(result TSRMLS_CC); > } > > - _free_sybase_result(result); > + FREE_SYBASE_RESULT(result); > } > > static void _close_sybase_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) > @@ -1166,8 +1181,6 @@ > > case CS_CANCELED: > default: > - _free_sybase_result(result); > - result = NULL; > retcode = CS_FAIL; > break; > } > @@ -1273,7 +1286,7 @@ > break; > > default: > - _free_sybase_result(result); > + FREE_SYBASE_RESULT(result); > result = NULL; > retcode = CS_FAIL; /* Just to be sure */ > break; > @@ -1463,17 +1476,9 @@ > INIT_PZVAL(tmp); > ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase > result", le_result); > > - /* Causes the following segfault: > - Program received signal SIGSEGV, Segmentation fault. > - 0x8144380 in _efree (ptr=0x81fe024, > __zend_filename=0x81841a0 "php4/ext/sybase_ct/php_sybase_ct.c", > - __zend_lineno=946, __zend_orig_filename=0x0, > __zend_orig_lineno=0) at php4/Zend/zend_alloc.c:229 > - php4/Zend/zend_alloc.c:229:7284:beg:0x8144380 > - */ > - #if O_TIMM > if (result) { > php_sybase_finish_results(result TSRMLS_CC); > } > - #endif > > zval_ptr_dtor(&tmp); > zend_list_delete(sybase_ptr->active_result_index); > @@ -1628,9 +1633,7 @@ > /* Retry deadlocks up until deadlock_retry_count times */ > if (sybase_ptr->deadlock && SybCtG(deadlock_retry_count) != -1 > && ++deadlock_count > SybCtG(deadlock_retry_count)) { > php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: > Retried deadlock %d times [max: %ld], giving up", deadlock_count- 1, > SybCtG(deadlock_retry_count)); > - if (result != NULL) { > - _free_sybase_result(result); > - } > + FREE_SYBASE_RESULT(result); > break; > } > > @@ -1649,9 +1652,7 @@ > * optimization, we could try not to fetch results in known > * deadlock conditions, but deadlock is (should be) rare. > */ > - if (result != NULL) { > - _free_sybase_result(result); > - } > + FREE_SYBASE_RESULT(result); > } > > if (status == Q_SUCCESS) { > @@ -1659,9 +1660,7 @@ > } > > if (status == Q_FAILURE) { > - if (result != NULL) { > - _free_sybase_result(result); > - } > + FREE_SYBASE_RESULT(result); > RETURN_FALSE; > } > > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php