]> granicus.if.org Git - php/commitdiff
imap_user and imap_password were freed too early.
authorfoobar <sniper@php.net>
Sun, 7 Jan 2001 07:47:46 +0000 (07:47 +0000)
committerfoobar <sniper@php.net>
Sun, 7 Jan 2001 07:47:46 +0000 (07:47 +0000)
PR: 8424

ext/imap/php_imap.c

index ca4b274a0384d6d936de5548b9582955bca3a1a7..c2bd5239772e38d71ffc313a6de83d9065ee5c22 100644 (file)
@@ -71,7 +71,7 @@ void *fs_get(size_t size);
 int imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char *rpath);
 
 
-void mail_close_it(zend_rsrc_list_entry *rsrc);
+void mail_close_it (zend_rsrc_list_entry *rsrc);
 #ifdef OP_RELOGIN
 /* AJS: close persistent connection */
 void mail_userlogout_it(zend_rsrc_list_entry *rsrc);
@@ -184,6 +184,9 @@ void mail_close_it(zend_rsrc_list_entry *rsrc)
 {
        pils *imap_le_struct = (pils *)rsrc->ptr;
        mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
+
+       efree(IMAPG(imap_user));
+       efree(IMAPG(imap_password));
        efree(imap_le_struct);
 }
 
@@ -766,8 +769,6 @@ void imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        } else {
 #endif
                imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags);
-               efree(IMAPG(imap_user));
-               efree(IMAPG(imap_password));
 
                if (imap_stream == NIL) {
                        php_error(E_WARNING, "Couldn't open stream %s\n", (*mailbox)->value.str.val);