cvs: php4 /ext/ircg ircg.c

From: Date: Wed, 10 Jan 2001 15:52:01 +0000
Subject: cvs: php4 /ext/ircg ircg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3543@lists.php.net to get a copy of this message
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); }

« previous php.cvs (#3543) next »