From: Christoph M. Becker Date: Thu, 15 Oct 2020 10:51:10 +0000 (+0200) Subject: Fix #80239: imap_rfc822_write_address() leaks memory X-Git-Tag: php-7.3.25RC1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5941b30bb889afcdd7684f9e0ce05ce72bb8256b;p=php Fix #80239: imap_rfc822_write_address() leaks memory We have to free the address when we're finished with it. --- diff --git a/NEWS b/NEWS index fb966d9b72..42b663cf40 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP NEWS - IMAP: . Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb) + . Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb) 29 Oct 2020, PHP 7.3.24 diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index db144b0d49..4acdc01338 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2305,6 +2305,7 @@ PHP_FUNCTION(imap_subscribe) } else { RETURN_FALSE; } + mail_free_address(&addr); } /* }}} */ diff --git a/ext/imap/tests/imap_rfc822_write_address_basic.phpt b/ext/imap/tests/imap_rfc822_write_address_basic.phpt new file mode 100644 index 0000000000..92e988c9c9 --- /dev/null +++ b/ext/imap/tests/imap_rfc822_write_address_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +imap_rfc822_write_address() : basic functionality +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(24) "My Name "