Patch pgsql.patch for PostgreSQL related Bug #52389
Patch version 2010-07-21 13:51 UTC
Return to Bug #52389 |
Download this patch
Patch Revisions:
Developer: miroslav.zacek@skype.net
*** a/ext/pgsql/pgsql.c 2010-01-03 10:23:27.000000000 +0100
--- b/ext/pgsql/pgsql.c 2010-07-21 13:58:20.354669750 +0200
*************** static char * _php_pgsql_trim_message(co
*** 742,748 ****
if (len) {
*len = i;
}
! return estrndup(message, i);
}
/* }}} */
--- 742,752 ----
if (len) {
*len = i;
}
!
! //return estrndup(message, i);
! char *ret_msg = (char *)pemalloc((i+1)*sizeof(char), 1);
! memcpy(ret_msg, message, (i+1)*sizeof(char));
! return ret_msg;
}
/* }}} */
*************** static void _php_pgsql_notice_handler(vo
*** 814,820 ****
TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
! notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
notice->message = _php_pgsql_trim_message(message, ¬ice->len);
if (PGG(log_notices)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
--- 818,824 ----
TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
! notice = (php_pgsql_notice *)pemalloc(sizeof(php_pgsql_notice), 1);
notice->message = _php_pgsql_trim_message(message, ¬ice->len);
if (PGG(log_notices)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
*************** static void _php_pgsql_notice_handler(vo
*** 824,839 ****
}
/* }}} */
! #define PHP_PGSQL_NOTICE_PTR_DTOR (void (*)(void *))_php_pgsql_notice_ptr_dtor
/* {{{ _php_pgsql_notice_dtor
*/
static void _php_pgsql_notice_ptr_dtor(void **ptr)
{
php_pgsql_notice *notice = (php_pgsql_notice *)*ptr;
! if (notice) {
! efree(notice->message);
! efree(notice);
notice = NULL;
}
}
--- 828,844 ----
}
/* }}} */
! #define PHP_PGSQL_NOTICE_PTR_DTOR (void (*)(void **))_php_pgsql_notice_ptr_dtor
/* {{{ _php_pgsql_notice_dtor
*/
static void _php_pgsql_notice_ptr_dtor(void **ptr)
{
php_pgsql_notice *notice = (php_pgsql_notice *)*ptr;
! int ref_count = (*(zval*)*ptr).refcount__gc;
! if (notice && ref_count) {
! pefree(notice->message, 1);
! pefree(notice, 1);
notice = NULL;
}
}
|