fixed several memory leaks caused by missing table_free calls
[NeonServV5.git] / src / modcmd.c
index ea8b416486f66b89d95a1cf28cd23d7071c6d146..8846d900197bc75b53c1e0181a04b062a093058a 100644 (file)
@@ -128,7 +128,8 @@ static void handle_command_async(struct ClientSocket *client, struct UserNode *u
 static USERAUTH_CALLBACK(command_checked_auth) {
     struct command_check_user_cache *cache = data;
     tmp_text_client = cache->textclient;
-    handle_command_async(cache->client, user, cache->chan, cache->sent_chan, cache->cbind, cache->argv, cache->argc);
+    if(user)
+        handle_command_async(cache->client, user, cache->chan, cache->sent_chan, cache->cbind, cache->argv, cache->argc);
     free(cache->message);
     if(cache->args_buffer)
         free(cache->args_buffer);
@@ -159,7 +160,7 @@ static struct cmd_binding *modcmd_linker_command(struct ClientSocket *client, st
                 break;
         }
         *args_ptr = args;
-        if(cbind->func->func == modcmd_linker) {
+        if(cbind && cbind->func->func == modcmd_linker) {
             return modcmd_linker_command(client, user, cbind, bind_index, args_ptr);
         }
         return cbind;
@@ -391,7 +392,7 @@ static void handle_command_async(struct ClientSocket *client, struct UserNode *u
         reply(tmp_text_client, user, "MODCMD_AUTH_REQUIRED");
         return;
     }
-    if(chan && sent_chan != chan && !isUserOnChan(user, chan)) {
+    if(chan && sent_chan != chan && (BIND_FLAGS(cbind) & CMDFLAG_NO_CROSSCHAN) && !isUserOnChan(user, chan)) {
         char user_in_chan = 0;
         if((user->flags & USERFLAG_ISAUTHED)) {
             //maybe there's another user authed to user->auth on the channel...