Browse Source

* Fix small memory leak if not running as a hub

Bryan Drewery 16 years ago
parent
commit
c311e4a222
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/chanprog.c

+ 1 - 3
src/chanprog.c

@@ -524,18 +524,16 @@ void load_internal_users()
 }
 }
 
 
 void add_myself_to_userlist() {
 void add_myself_to_userlist() {
-  struct bot_addr *bi = NULL;
-
   if (!(conf.bot->u = get_user_by_handle(userlist, conf.bot->nick))) {
   if (!(conf.bot->u = get_user_by_handle(userlist, conf.bot->nick))) {
     /* I need to be on the userlist... doh. */
     /* I need to be on the userlist... doh. */
     userlist = adduser(userlist, conf.bot->nick, "none", "-", USER_OP, 1);
     userlist = adduser(userlist, conf.bot->nick, "none", "-", USER_OP, 1);
     conf.bot->u = get_user_by_handle(userlist, conf.bot->nick);
     conf.bot->u = get_user_by_handle(userlist, conf.bot->nick);
-    bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
 
 
     /* Assume hub has a record added from load_internal_users();
     /* Assume hub has a record added from load_internal_users();
        why would it think it was a hub if it wasn't in the hub list??
        why would it think it was a hub if it wasn't in the hub list??
     */
     */
     if (!conf.bot->hub) {
     if (!conf.bot->hub) {
+      struct bot_addr *bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
       if (conf.bot->net.ip)
       if (conf.bot->net.ip)
         bi->address = strdup(conf.bot->net.ip);
         bi->address = strdup(conf.bot->net.ip);
       bi->telnet_port = bi->relay_port = 3333;
       bi->telnet_port = bi->relay_port = 3333;