sas             Wed Jan 10 07:52:01 2001 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Check the return value irc_connect().  There are some cases where
  that function would fail and we were leaking memory.
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.11 php4/ext/ircg/ircg.c:1.12
--- php4/ext/ircg/ircg.c:1.11   Wed Jan 10 05:50:25 2001
+++ php4/ext/ircg/ircg.c        Wed Jan 10 07:52:01 2001
@@ -531,6 +531,13 @@
        conn = malloc(sizeof(*conn));
        conn->username = strdup(username);
        conn->fd = -1;
+
+       if (irc_connect(username, NULL, msg_handler, quit_handler, error_handler,
+                       conn, server, port, &conn->conn)) {
+               free(conn->username);
+               free(conn);
+               RETVAL_FALSE;
+       }
        if (p4) {
                HashTable *h;
                int i;
@@ -551,8 +558,6 @@
        conn->irconn_id = irconn_id;
        zend_hash_index_update(&h_irconn, irconn_id, &conn, sizeof(conn), NULL);
        zend_llist_init(&conn->buffer, sizeof(smart_str), buffer_dtor, 1);
-       irc_connect(username, NULL, msg_handler, quit_handler, error_handler,
-                       conn, server, port, &conn->conn);
 
        RETVAL_LONG(irconn_id);
 }



-- 
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