diff options
author | Test_User <hax@andrewyu.org> | 2023-11-26 02:19:27 -0500 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2023-11-26 02:19:27 -0500 |
commit | 16049194444f9acc27b9ed6b8de6b39651c5a8fd (patch) | |
tree | 968f2a253b8093b454f58a5491a62e2515161941 | |
parent | f79a5dbfbadf78baf5683eede02a8454e403f58e (diff) | |
download | coupserv-16049194444f9acc27b9ed6b8de6b39651c5a8fd.tar.gz coupserv-16049194444f9acc27b9ed6b8de6b39651c5a8fd.zip |
Fix memory errors, disable spam command
Diffstat (limited to '')
-rw-r--r-- | commands.c | 2 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | table.c | 2 |
3 files changed, 2 insertions, 3 deletions
@@ -243,7 +243,7 @@ int init_user_commands(void) { set_table_index(&user_commands, STRING("sus"), &sus_command_def); set_table_index(&user_commands, STRING("cr"), &cr_command_def); set_table_index(&user_commands, STRING("help"), &help_command_def); - set_table_index(&user_commands, STRING("spam"), &spam_command_def); +// set_table_index(&user_commands, STRING("spam"), &spam_command_def); set_table_index(&user_commands, STRING("clear"), &clear_command_def); return 0; @@ -45,7 +45,6 @@ void *client_loop(void *ign) { pthread_mutex_lock(&send_lock); listen(client_listen_fd, 0); client_connected = 0; - client_nick.data = malloc(0); while (1) { char data[512]; pthread_mutex_unlock(&send_lock); // TODO: proper locking, this works for now but is certainly inefficient @@ -161,7 +161,7 @@ void * remove_table_index(struct table *tbl, struct string name) { void *ptr = tbl->array[index].ptr; free(tbl->array[index].name.data); - memmove(&(tbl->array[index]), &(tbl->array[index+1]), (tbl->len - index) * sizeof(*(tbl->array))); + memmove(&(tbl->array[index]), &(tbl->array[index+1]), (tbl->len - index - 1) * sizeof(*(tbl->array))); tbl->len--; void *tmp = realloc(tbl->array, sizeof(*(tbl->array)) * tbl->len); |