]> granicus.if.org Git - php/commitdiff
Ignore memory leaks reported for some libc-client functions
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 12 Oct 2020 15:28:24 +0000 (17:28 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Tue, 13 Oct 2020 11:09:29 +0000 (13:09 +0200)
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

index 8c74c8b29a33c454eef48a224cef92a13b88bd36..6a7cfe7037ea432c519d6b4357c93ffa31a67b5c 100644 (file)
@@ -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;
        }