]> granicus.if.org Git - php/commitdiff
- MF53: #48619, imap_search ALL segfaults
authorPierre Joye <pajoye@php.net>
Mon, 22 Jun 2009 20:42:04 +0000 (20:42 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 22 Jun 2009 20:42:04 +0000 (20:42 +0000)
ext/imap/php_imap.c

index ea4e8d5761b0806c18ccb0b898d94f616eb5c1eb..24111e139923061ae1073c5f666ebb65bc1bbe33 100644 (file)
@@ -2670,7 +2670,7 @@ PHP_FUNCTION(imap_sort)
 
        slst = mail_sort(imap_le_struct->imap_stream, (myargc == 6 ? Z_STRVAL_PP(charset) : NIL), spg, mypgm, (myargc >= 4 ? Z_LVAL_PP(flags) : NIL));
 
-       if (spg) {
+       if (spg && !(flags & SE_FREE)) {
                mail_free_searchpgm(&spg);
        }
 
@@ -3712,7 +3712,7 @@ PHP_FUNCTION(imap_search)
 
        mail_search_full(imap_le_struct->imap_stream, (argc == 4 ? Z_STRVAL_PP(charset) : NIL), pgm, flags);
 
-       if (pgm) {
+       if (pgm && !(flags & SE_FREE)) {
                mail_free_searchpgm(&pgm);
        }
 
@@ -4341,7 +4341,7 @@ PHP_FUNCTION(imap_thread)
 
        pgm = mail_criteria(criteria);
        top = mail_thread(imap_le_struct->imap_stream, "REFERENCES", NIL, pgm, flags);
-       if (pgm) {
+       if (pgm && !(flags & SE_FREE)) {
                mail_free_searchpgm(&pgm);
        }