aboutsummaryrefslogtreecommitdiff
path: root/snowcast_server_concurrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'snowcast_server_concurrent.c')
-rw-r--r--snowcast_server_concurrent.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/snowcast_server_concurrent.c b/snowcast_server_concurrent.c
index bb3eee9..d853507 100644
--- a/snowcast_server_concurrent.c
+++ b/snowcast_server_concurrent.c
@@ -274,6 +274,7 @@ void *send_udp_packet_routine(void *arg) {
int int_port = user_data[user_index].udpPort;
int length = snprintf( NULL, 0, "%d", int_port );
char* port = malloc( length + 1 );
+ if (!port) { perror("malloc"); return (NULL); }
snprintf( port, length + 1, "%d", int_port );
sprintf(port, "%d", int_port);
@@ -703,6 +704,10 @@ void send_announce_reply(int fd, int station_num) {
int len_file_path = strlen(file_path);
char *send_buffer = malloc(len_file_path+2);
+ if (!send_buffer) {
+ perror("malloc");
+ return;
+ }
send_buffer[0] = 3;
send_buffer[1] = len_file_path;
@@ -721,6 +726,10 @@ void send_announce_reply(int fd, int station_num) {
void send_invalid_command_reply(int fd, size_t message_size, char* message) {
char *send_buffer = malloc(message_size+2);
+ if (!send_buffer) {
+ perror("malloc");
+ return;
+ }
// type and payload size
send_buffer[0] = 4;