cvs: ZendEngine2 / zend_API.h

From: Date: Thu, 19 Oct 2006 20:54:48 +0000
Subject: cvs: ZendEngine2 / zend_API.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5341@lists.php.net to get a copy of this message
andrei Thu Oct 19 20:54:48 2006 UTC Modified files: /ZendEngine2 zend_API.h Log: Fix potential (and real) leaks due to bad macro writing. Grrr. http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.265&r2=1.266&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.265 ZendEngine2/zend_API.h:1.266 --- ZendEngine2/zend_API.h:1.265 Thu Oct 19 18:27:35 2006 +++ ZendEngine2/zend_API.h Thu Oct 19 20:54:48 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.265 2006/10/19 18:27:35 andrei Exp $ */ +/* $Id: zend_API.h,v 1.266 2006/10/19 20:54:48 andrei Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -1599,12 +1599,13 @@ #define ZVAL_ASCII_STRING(z, s, flags) \ if (UG(unicode)) { \ - uint length = strlen(s); \ - UChar *u_str = zend_ascii_to_unicode((s), length+1 ZEND_FILE_LINE_CC); \ + char *__s = (s); \ + int __s_len = strlen(__s); \ + UChar *u_str = zend_ascii_to_unicode(__s, __s_len+1 ZEND_FILE_LINE_CC); \ if ((flags) & ZSTR_AUTOFREE) { \ - efree(s); \ + efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, length, 0); \ + ZVAL_UNICODEL(z, u_str, __s_len, 0); \ } else { \ char *__s=(s); \ Z_STRLEN_P(z) = strlen(__s); \ @@ -1614,12 +1615,13 @@ #define ZVAL_ASCII_STRINGL(z, s, l, flags) \ if (UG(unicode)) { \ - int u_len = l; \ - UChar *u_str = zend_ascii_to_unicode((s), (u_len)+1 ZEND_FILE_LINE_CC); \ + char *__s = (s); \ + int __s_len = (l); \ + UChar *u_str = zend_ascii_to_unicode((__s), (__s_len)+1 ZEND_FILE_LINE_CC); \ if ((flags) & ZSTR_AUTOFREE) { \ - efree(s); \ + efree(__s); \ } \ - ZVAL_UNICODEL(z, u_str, u_len, 0); \ + ZVAL_UNICODEL(z, u_str, __s_len, 0); \ } else { \ char *__s=(s); int __l=l; \ Z_STRLEN_P(z) = __l; \ @@ -1630,12 +1632,13 @@ #define ZVAL_U_STRING(conv, z, s, flags) \ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ + char *__s = (s); \ + int __s_len = strlen(__s); \ UChar *u_str; \ int u_len; \ - uint length = strlen(s); \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, s, length, &status); \ + zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ if ((flags) & ZSTR_AUTOFREE) { \ - efree(s); \ + efree(__s); \ } \ ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ @@ -1648,11 +1651,13 @@ #define ZVAL_U_STRINGL(conv, z, s, l, flags) \ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ + char *__s = (s); \ + int __s_len = (l); \ UChar *u_str; \ int u_len; \ - zend_string_to_unicode_ex(conv, &u_str, &u_len, s, l, &status); \ + zend_string_to_unicode_ex(conv, &u_str, &u_len, __s, __s_len, &status); \ if ((flags) & ZSTR_AUTOFREE) { \ - efree(s); \ + efree(__s); \ } \ ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \

« previous php.zend-engine.cvs (#5341) next »