From a9ffad836eafa989b2d4e489fe2d591169b1de8e Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 2 Apr 2017 09:11:05 +0430 Subject: fixed some issues --- daemon/daemon_aux.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'daemon/daemon_aux.c') diff --git a/daemon/daemon_aux.c b/daemon/daemon_aux.c index 3a78eb6..3572972 100644 --- a/daemon/daemon_aux.c +++ b/daemon/daemon_aux.c @@ -149,11 +149,14 @@ int mutator_server(FILE* log_file) #endif #if 1 - for (int i = 0; i < strlen(temp); ++i) + if (temp != NULL) { - if (i == strlen(temp) - 1) + for (int i = 0; i < strlen(temp); ++i) { - temp[i] = '\0'; + if (i == strlen(temp) - 1) + { + temp[i] = '\0'; + } } } full_command = malloc(strlen(temp) + strlen(client_message) + strlen(driver_name) + 1); @@ -181,11 +184,14 @@ int mutator_server(FILE* log_file) { fprintf(log_file, "%s", "what are you trying to do exactly?"); write(client_sock, BADOUT, strlen(BADOUT)); + free(full_command); + fclose(mutator_config); continue; } fprintf(log_file, "%s", "freeing memory reserved for command.\n"); free(full_command); + fclose(mutator_config); if (clientistream == NULL) { -- cgit v1.2.3