php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64467
Patch imap_reopen_crash.patch revision 2013-03-20 21:41 UTC by askalski at gmail dot com

Patch imap_reopen_crash.patch for IMAP related Bug #64467

Patch version 2013-03-20 21:41 UTC

Return to Bug #64467 | Download this patch
Patch Revisions:

Developer: askalski@gmail.com

diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index b154cb8..d196a9e 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1270,7 +1270,6 @@ PHP_FUNCTION(imap_reopen)
 	int mailbox_len;
 	long options = 0, retries = 0;
 	pils *imap_le_struct;
-	MAILSTREAM *imap_stream;
 	long flags=NIL;
 	long cl_flags=NIL;
 
@@ -1298,12 +1297,12 @@ PHP_FUNCTION(imap_reopen)
 		RETURN_FALSE;
 	}
 
-	imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags);
-	if (imap_stream == NIL) {
+	imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags);
+	if (imap_le_struct->imap_stream == NIL) {
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open stream");
+		zend_list_delete(Z_RESVAL_P(streamind));
 		RETURN_FALSE;
 	}
-	imap_le_struct->imap_stream = imap_stream;
 	RETURN_TRUE;
 }
 /* }}} */
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 02:02:10 2014 UTC