diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-15 12:51:10 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-15 12:54:53 +0200 |
commit | 5941b30bb889afcdd7684f9e0ce05ce72bb8256b (patch) | |
tree | 88a91a67bd90046db231a93e5aab09930b29a638 /ext | |
parent | a29016d70d72dacb688b4df334508edb550d688f (diff) | |
download | php-git-5941b30bb889afcdd7684f9e0ce05ce72bb8256b.tar.gz |
Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/imap/php_imap.c | 1 | ||||
-rw-r--r-- | ext/imap/tests/imap_rfc822_write_address_basic.phpt | 12 |
2 files changed, 13 insertions, 0 deletions
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-- +<?php +if (!extension_loaded('imap')) die('skip imap extension not available'); +?> +--FILE-- +<?php +var_dump(imap_rfc822_write_address('me', 'example.com', 'My Name')); +?> +--EXPECT-- +string(24) "My Name <me@example.com>" |