diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 21:08:29 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 21:08:29 +0200 |
commit | 070144ea27766fc006c48674bc21dd0269b3c015 (patch) | |
tree | 871b09b260b78a4f6bb8b0e551492d5a2511e4de /src | |
parent | server: notify all threads about shutting down (diff) | |
download | cimple-070144ea27766fc006c48674bc21dd0269b3c015.tar.gz cimple-070144ea27766fc006c48674bc21dd0269b3c015.zip |
worker: fix a crash
Found when running in Docker.
Diffstat (limited to 'src')
-rw-r--r-- | src/process.c | 7 | ||||
-rw-r--r-- | src/process.h | 1 | ||||
-rw-r--r-- | src/worker.c | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c index fa15641..1a4b032 100644 --- a/src/process.c +++ b/src/process.c @@ -114,6 +114,13 @@ close_pipe: return ret; } +void proc_output_init(struct proc_output *output) +{ + output->ec = 0; + output->output = NULL; + output->output_len = 0; +} + void proc_output_free(const struct proc_output *output) { free(output->output); diff --git a/src/process.h b/src/process.h index d47536f..b378ad1 100644 --- a/src/process.h +++ b/src/process.h @@ -18,6 +18,7 @@ int proc_spawn(const char *args[], int *ec); * In that case, you'll need to free the output. */ int proc_capture(const char *args[], struct proc_output *result); +void proc_output_init(struct proc_output *); void proc_output_free(const struct proc_output *); #endif diff --git a/src/worker.c b/src/worker.c index baba9b0..fef6b78 100644 --- a/src/worker.c +++ b/src/worker.c @@ -87,6 +87,7 @@ static int msg_ci_run_handler(struct worker *worker, const struct msg *request) struct proc_output result; int ret = 0; + proc_output_init(&result); ret = msg_ci_run_do(request->argv[1], request->argv[2], &result); proc_output_free(&result); |