chagenbu                Tue Apr 24 07:17:41 2001 EDT

  Modified files:              (Branch: PHP_4_0_5)
    /php4/ext/imap      php_imap.c 
  Log:
  MFH: fix crash bug in imap_sort (#9908).
  
  
Index: php4/ext/imap/php_imap.c
diff -u php4/ext/imap/php_imap.c:1.62.2.1 php4/ext/imap/php_imap.c:1.62.2.2
--- php4/ext/imap/php_imap.c:1.62.2.1   Fri Mar 16 05:24:06 2001
+++ php4/ext/imap/php_imap.c    Tue Apr 24 07:17:41 2001
@@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_imap.c,v 1.62.2.1 2001/03/16 13:24:06 kalowsky Exp $ */
+/* $Id: php_imap.c,v 1.62.2.2 2001/04/24 14:17:41 chagenbu Exp $ */
 
 #define IMAP41
 
@@ -2748,12 +2748,18 @@
        mypgm->next = NIL;
        
        slst = mail_sort(imap_le_struct->imap_stream, NIL, spg, mypgm, myargc >= 4 ? 
Z_LVAL_PP(flags) : NIL);
+       if (spg) {
+               mail_free_searchpgm(&spg);
+       }
+
        
        array_init(return_value);
-       for (sl = slst; *sl; sl++) { 
-               add_next_index_long(return_value, *sl);
+       if (slst != NIL && slst != 0) {
+               for (sl = slst; *sl; sl++) { 
+                       add_next_index_long(return_value, *sl);
+               }
+               fs_give ((void **) &slst);
        }
-       fs_give ((void **) &slst); 
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to