diff options
author | Thies C. Arntzen <thies@php.net> | 2001-02-18 18:15:01 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 2001-02-18 18:15:01 +0000 |
commit | 84c243d3cce9ecf39ac03304b896ba46d4c95d4d (patch) | |
tree | 65178db84dc457f90f83b15cd9c4e66927a645b1 /ext/imap | |
parent | a7679d255635eb0ef3f51c9f0934b71621febe30 (diff) | |
download | php-git-84c243d3cce9ecf39ac03304b896ba46d4c95d4d.tar.gz |
fixed a possible double-free
Diffstat (limited to 'ext/imap')
-rw-r--r-- | ext/imap/php_imap.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index ffaca95762..6ae8862194 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -187,8 +187,15 @@ void mail_close_it(zend_rsrc_list_entry *rsrc) mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags); - efree(IMAPG(imap_user)); - efree(IMAPG(imap_password)); + if (IMAPG(imap_user)) { + efree(IMAPG(imap_user)); + IMAPG(imap_user) = 0; + } + if (IMAPG(imap_password)) { + efree(IMAPG(imap_password)); + IMAPG(imap_password) = 0; + } + efree(imap_le_struct); } @@ -638,6 +645,14 @@ void imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } + if (IMAPG(imap_user)) { + efree(IMAPG(imap_user)); + } + + if (IMAPG(imap_password)) { + efree(IMAPG(imap_password)); + } + IMAPG(imap_user) = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user)); IMAPG(imap_password) = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd)); |