diff options
Diffstat (limited to 'daemon/daemon_aux.c')
-rw-r--r-- | daemon/daemon_aux.c | 12 |
1 files changed, 9 insertions, 3 deletions
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) { |