Skip to content

Commit 5941b30

Browse files
committed
Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
1 parent a29016d commit 5941b30

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PHP NEWS
44

55
- IMAP:
66
. Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb)
7+
. Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb)
78

89
29 Oct 2020, PHP 7.3.24
910

ext/imap/php_imap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,6 +2305,7 @@ PHP_FUNCTION(imap_subscribe)
23052305
} else {
23062306
RETURN_FALSE;
23072307
}
2308+
mail_free_address(&addr);
23082309
}
23092310
/* }}} */
23102311

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
imap_rfc822_write_address() : basic functionality
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('imap')) die('skip imap extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
var_dump(imap_rfc822_write_address('me', 'example.com', 'My Name'));
10+
?>
11+
--EXPECT--
12+
string(24) "My Name <me@example.com>"

0 commit comments

Comments
 (0)