aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-09-21 07:06:14 +0000
committersotech117 <michael_foiani@brown.edu>2023-09-21 07:06:14 +0000
commit9ba49f755e152d0996a43e8da7d146b8d2069051 (patch)
treedde7fe228fc6ab44c3c462576a391193e3189da5 /client.c
parent433f6eb3a54881913286aa620db93c003c436c16 (diff)
add timeout
Diffstat (limited to 'client.c')
-rw-r--r--client.c3
1 files changed, 3 insertions, 0 deletions
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");