From 91333d73f61135e9debc7e83d0f8c91e012e03c7 Mon Sep 17 00:00:00 2001 From: Duc Date: Fri, 27 Nov 2020 22:18:57 +0900 Subject: [PATCH] various minors --- client.c | 7 +++++++ jobs.c | 4 +++- main.h | 2 +- server.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index faf0281..158a972 100755 --- a/client.c +++ b/client.c @@ -368,6 +368,7 @@ static char *get_output_file(int *pid) { error("Error in get_output_file line size"); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -487,6 +488,7 @@ void c_remove_job() { res = recv_bytes(server_socket, string, m.u.size); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -515,6 +517,7 @@ int c_wait_job_recv() { error("Error in wait_job - line size"); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -610,6 +613,7 @@ void c_move_urgent() { error("Error in move_urgent - line size"); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -645,6 +649,7 @@ void c_get_state() { error("Error in get_state - line size"); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -680,6 +685,7 @@ void c_swap_jobs() { error("Error in swap_jobs - line size"); fprintf(stderr, "Error in the request: %s", string); + free(string); exit(-1); /* WILL NOT GO FURTHER */ default: @@ -737,6 +743,7 @@ void c_show_label() { error("Error in get_label - line size"); printf("%s", string); + free(string); return; default: warning("Wrong internal message in get_label"); diff --git a/jobs.c b/jobs.c index 90e01ba..8eeb4fa 100755 --- a/jobs.c +++ b/jobs.c @@ -213,7 +213,7 @@ int s_count_allocating_jobs() { return count; } -void s_get_label(int s, int jobid) { +void s_send_label(int s, int jobid) { struct Job *p = 0; char *label; @@ -250,6 +250,8 @@ void s_get_label(int s, int jobid) { } else label = ""; send_list_line(s, label); + if (p->label) + free(label); } void s_send_cmd(int s, int jobid) { diff --git a/main.h b/main.h index ad40f3d..1023b40 100755 --- a/main.h +++ b/main.h @@ -340,7 +340,7 @@ int job_is_holding_client(int jobid); int wake_hold_client(); -void s_get_label(int s, int jobid); +void s_send_label(int s, int jobid); void s_kill_all_jobs(int s); diff --git a/server.c b/server.c index a2b0e1f..5081d92 100755 --- a/server.c +++ b/server.c @@ -400,7 +400,7 @@ client_read(int index) { s_send_last_id(s); break; case GET_LABEL: - s_get_label(s, m.u.jobid); + s_send_label(s, m.u.jobid); break; case GET_CMD: s_send_cmd(s, m.u.jobid);