Skip to content

Commit 9c7b607

Browse files
committed
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.
1 parent 8782c61 commit 9c7b607

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/imap/php_imap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
12571257
}
12581258
#endif
12591259

1260+
ZEND_IGNORE_LEAKS_BEGIN();
12601261
imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags);
1262+
ZEND_IGNORE_LEAKS_END();
12611263

12621264
if (imap_stream == NIL) {
12631265
php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox));
@@ -2227,7 +2229,9 @@ PHP_FUNCTION(imap_lsub)
22272229
IMAPG(folderlist_style) = FLIST_ARRAY;
22282230

22292231
IMAPG(imap_sfolders) = NIL;
2232+
ZEND_IGNORE_LEAKS_BEGIN();
22302233
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
2234+
ZEND_IGNORE_LEAKS_END();
22312235
if (IMAPG(imap_sfolders) == NIL) {
22322236
RETURN_FALSE;
22332237
}
@@ -2266,7 +2270,9 @@ PHP_FUNCTION(imap_lsub_full)
22662270
IMAPG(folderlist_style) = FLIST_OBJECT;
22672271

22682272
IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL;
2273+
ZEND_IGNORE_LEAKS_BEGIN();
22692274
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
2275+
ZEND_IGNORE_LEAKS_END();
22702276
if (IMAPG(imap_sfolder_objects) == NIL) {
22712277
RETURN_FALSE;
22722278
}

0 commit comments

Comments
 (0)