trimming client input text

This commit is contained in:
Václav Šmejkal 2024-04-25 21:13:55 +02:00
parent f07a5fe40f
commit f325b928eb
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -118,6 +118,9 @@ int main(void)
} }
line = (char*) return_line; line = (char*) return_line;
why2_trim_string(&line);
if (line == NULL) line = strdup("");
printf(WHY2_CLEAR_AND_GO_UP); printf(WHY2_CLEAR_AND_GO_UP);
@ -141,7 +144,7 @@ int main(void)
} else } else
{ {
why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT
free(return_line); free(line);
} }
} }
@ -149,7 +152,7 @@ int main(void)
if (!ssqc) if (!ssqc)
{ {
pthread_cancel(thread_buffer); pthread_cancel(thread_buffer);
free(return_line); free(line);
} }
why2_chat_deallocate_keys(); //DEALLOCATE GETTERS FOR KEYS why2_chat_deallocate_keys(); //DEALLOCATE GETTERS FOR KEYS