From 802cbbd49b918b7a59b8f77f802d838800e5d9b7 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Thu, 30 Apr 2009 18:55:44 +0000 Subject: [PATCH] - #47940, memory leaks in imap_body --- NEWS | 1 + ext/imap/php_imap.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e42296e86f..9d79372b5e 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ PHP NEWS - Fixed bug #47969 (ezmlm_hash() returns different values depend on OS). (Ilia) - Fixed bug #47946 (ImageConvolution overwrites background). (Ilia) +- Fixed bug #47940 (memory leaks in imap_body). (Pierre, Jake Levitt) - Fixed bug #47937 (system() calls sapi_flush() regardless of output buffering). (Ilia) - Fixed bug #47903 ("@" operator does not work with string offsets). (Felipe) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index a2ba16df7c..ea4e8d5761 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -487,7 +487,7 @@ PHP_MINIT_FUNCTION(imap) REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); /* plug in our gets */ - mail_parameters(NIL, SET_GETS, (void *) php_mail_gets); + mail_parameters(NIL, SET_GETS, (void *) NIL); /* set default timeout values */ mail_parameters(NIL, SET_OPENTIMEOUT, (void *) FG(default_socket_timeout)); @@ -1266,7 +1266,6 @@ PHP_FUNCTION(imap_body) } else { RETVAL_STRINGL(body, body_len, 1); } - free(body); } /* }}} */ @@ -1995,7 +1994,9 @@ PHP_FUNCTION(imap_savebody) } IMAPG(gets_stream) = writer; + mail_parameters(NIL, SET_GETS, (void *) php_mail_gets); mail_fetchbody_full(imap_ptr->imap_stream, msgno, section, NULL, flags); + mail_parameters(NIL, SET_GETS, (void *) NIL); IMAPG(gets_stream) = NULL; if (close_stream) { -- 2.50.1