From f325b928ebee0382f9e06522972855d23b079ae7 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 25 Apr 2024 21:13:55 +0200 Subject: [PATCH] trimming client input text --- src/chat/main/client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chat/main/client.c b/src/chat/main/client.c index 1211180..60071f1 100644 --- a/src/chat/main/client.c +++ b/src/chat/main/client.c @@ -118,6 +118,9 @@ int main(void) } line = (char*) return_line; + why2_trim_string(&line); + + if (line == NULL) line = strdup(""); printf(WHY2_CLEAR_AND_GO_UP); @@ -141,7 +144,7 @@ int main(void) } 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 - free(return_line); + free(line); } } @@ -149,7 +152,7 @@ int main(void) if (!ssqc) { pthread_cancel(thread_buffer); - free(return_line); + free(line); } why2_chat_deallocate_keys(); //DEALLOCATE GETTERS FOR KEYS