]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-mode.c
Pidfile_Create(): Don't leak file descriptor on error path
[ngircd-alex.git] / src / ngircd / irc-mode.c
index ad83ae98a7aa93d0ee0931e5e6396de91cfa8d57..fa35cdd0f29d7742d92c169f6ce992a56eaa1ca5 100644 (file)
@@ -856,7 +856,8 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
            const char *Pattern)
 {
        const char *mask;
-       struct list_head *list;
+       struct list_head *list = NULL;
+       long int current_count;
 
        assert(Client != NULL);
        assert(Channel != NULL);
@@ -864,6 +865,9 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
        assert(what == 'I' || what == 'b' || what == 'e');
 
        mask = Lists_MakeMask(Pattern);
+       current_count = Lists_Count(Channel_GetListInvites(Channel))
+                       + Lists_Count(Channel_GetListExcepts(Channel))
+                       + Lists_Count(Channel_GetListBans(Channel));
 
        switch(what) {
                case 'I':
@@ -880,7 +884,7 @@ Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
        if (Lists_CheckDupeMask(list, mask))
                return CONNECTED;
        if (Client_Type(Client) == CLIENT_USER &&
-           Lists_Count(list) >= MAX_HNDL_CHANNEL_LISTS)
+           current_count >= MAX_HNDL_CHANNEL_LISTS)
                return IRC_WriteStrClient(Client, ERR_LISTFULL_MSG,
                                          Client_ID(Client),
                                          Channel_Name(Channel), mask,
@@ -919,7 +923,7 @@ Del_From_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
              const char *Pattern)
 {
        const char *mask;
-       struct list_head *list;
+       struct list_head *list = NULL;
 
        assert(Client != NULL);
        assert(Channel != NULL);