From 9c7b6073203ed3db749c26e88d4f0c2514a60101 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 12 Oct 2020 17:28:24 +0200 Subject: [PATCH] Ignore memory leaks reported for some libc-client functions At least on Windows, some static variables are lazily initialized during `mail_open()` and `mail_lsub()`, which are reported as memory leaks. We suppress these false positives. Closes GH-6326. --- ext/imap/php_imap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 8c74c8b29a..6a7cfe7037 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1257,7 +1257,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } #endif + ZEND_IGNORE_LEAKS_BEGIN(); imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags); + ZEND_IGNORE_LEAKS_END(); if (imap_stream == NIL) { php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox)); @@ -2227,7 +2229,9 @@ PHP_FUNCTION(imap_lsub) IMAPG(folderlist_style) = FLIST_ARRAY; IMAPG(imap_sfolders) = NIL; + ZEND_IGNORE_LEAKS_BEGIN(); mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); + ZEND_IGNORE_LEAKS_END(); if (IMAPG(imap_sfolders) == NIL) { RETURN_FALSE; } @@ -2266,7 +2270,9 @@ PHP_FUNCTION(imap_lsub_full) IMAPG(folderlist_style) = FLIST_OBJECT; IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL; + ZEND_IGNORE_LEAKS_BEGIN(); mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); + ZEND_IGNORE_LEAKS_END(); if (IMAPG(imap_sfolder_objects) == NIL) { RETURN_FALSE; } -- 2.40.0