summaryrefslogtreecommitdiff
path: root/ext/imap/php_imap.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-01-17 16:07:39 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-01-17 16:07:39 +0000
commitfb6517e8ab9d1630ed75822337a6ad6c5b6f2460 (patch)
treed82087c293166a115582a6c1dd342528da5d26af /ext/imap/php_imap.c
parentf94cbfe52b1597b402e76c5af91180a2c69223d2 (diff)
downloadphp-git-fb6517e8ab9d1630ed75822337a6ad6c5b6f2460.tar.gz
Fixed memory leaks in imap_get_quota & imap_get_quotaroot.
Removed pointless checks around array_init().
Diffstat (limited to 'ext/imap/php_imap.c')
-rw-r--r--ext/imap/php_imap.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index a5859511e1..af12742c12 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -343,12 +343,7 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
/* put parsing code here */
for(; qlist; qlist = qlist->next) {
MAKE_STD_ZVAL(t_map);
- if (array_init(t_map) == FAILURE) {
- php_error(E_WARNING, "Unable to allocate t_map memory");
- FREE_ZVAL(t_map);
- FREE_ZVAL(IMAPG(quota_return));
- return;
- }
+ array_init(t_map);
if (strncmp(qlist->name, "STORAGE", 7) == 0)
{
/* this is to add backwards compatibility */
@@ -859,16 +854,13 @@ PHP_FUNCTION(imap_get_quota)
convert_to_string_ex(qroot);
MAKE_STD_ZVAL(IMAPG(quota_return));
- if (array_init(IMAPG(quota_return)) == FAILURE) {
- php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C));
- FREE_ZVAL(IMAPG(quota_return));
- RETURN_FALSE;
- }
+ array_init(IMAPG(quota_return));
/* set the callback for the GET_QUOTA function */
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
php_error(E_WARNING, "%s(): c-client imap_getquota failed", get_active_function_name(TSRMLS_C));
+ FREE_ZVAL(IMAPG(quota_return));
RETURN_FALSE;
}
@@ -893,16 +885,13 @@ PHP_FUNCTION(imap_get_quotaroot)
convert_to_string_ex(mbox);
MAKE_STD_ZVAL(IMAPG(quota_return));
- if (array_init(IMAPG(quota_return)) == FAILURE) {
- php_error(E_WARNING, "%s(): Unable to allocate array memory", get_active_function_name(TSRMLS_C));
- FREE_ZVAL(IMAPG(quota_return));
- RETURN_FALSE;
- }
+ array_init(IMAPG(quota_return));
/* set the callback for the GET_QUOTAROOT function */
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if(!imap_getquotaroot(imap_le_struct->imap_stream, Z_STRVAL_PP(mbox))) {
php_error(E_WARNING, "%s(): c-client imap_getquotaroot failed", get_active_function_name(TSRMLS_C));
+ FREE_ZVAL(IMAPG(quota_return));
RETURN_FALSE;
}
@@ -1028,9 +1017,7 @@ PHP_FUNCTION(imap_headers)
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
/* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream, msgno);
@@ -1971,9 +1958,7 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
rfc822_parse_adrlist(&env->to, Z_STRVAL_PP(str), Z_STRVAL_PP(defaulthost));
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
addresstmp = env->to;
@@ -3493,9 +3478,7 @@ PHP_FUNCTION(imap_mime_header_decode)
convert_to_string_ex(str);
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
string = Z_STRVAL_PP(str);
end = Z_STRLEN_PP(str);
@@ -3901,7 +3884,7 @@ static int build_thread_tree(THREADNODE *top, zval **tree)
long numNodes = 0;
char buf[25];
- if(array_init(*tree) != SUCCESS) return FAILURE;
+ array_init(*tree);
build_thread_tree_helper(top, *tree, &numNodes, buf);