From 9ba49f755e152d0996a43e8da7d146b8d2069051 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Thu, 21 Sep 2023 07:06:14 +0000 Subject: add timeout --- client.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'client.c') diff --git a/client.c b/client.c index 852e7ff..760b494 100644 --- a/client.c +++ b/client.c @@ -170,6 +170,8 @@ void *reply_thread_routine(void* args) { exit(1); } char *song_name = malloc(string_size); + if(song_name == NULL) { perror("malloc in song name"); } + int bytes_to_read = string_size; if (recv_all(sockfd, song_name, &bytes_to_read) == -1) { perror("recv_all"); @@ -186,6 +188,7 @@ void *reply_thread_routine(void* args) { exit(1); } char *message = malloc(string_size); + if(message == NULL) { perror("malloc in message"); } int bytes_to_read = string_size; if (recv_all(sockfd, message, &bytes_to_read) == -1) { perror("recv_all"); -- cgit v1.2.3-70-g09d2