summaryrefslogtreecommitdiffstats
path: root/batchd.c
diff options
context:
space:
mode:
Diffstat (limited to 'batchd.c')
-rw-r--r--batchd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/batchd.c b/batchd.c
index 4a0dc4b..c2cadc8 100644
--- a/batchd.c
+++ b/batchd.c
@@ -67,13 +67,16 @@ process_queue(char *queuedir, int dfd)
fd = open(name, O_RDONLY);
if (fd == -1) {
- goto end;
+ goto next;
}
rename(name, work);
pid = run_job(queuedir, fd);
if (pid == -1) {
rename(work, failed);
- return;
+ free(name);
+ free(work);
+ free(failed);
+ break;
}
for (i = 0; i < MAX_JOBS; i++) {
if (jobs[i].pid == -1) {
@@ -84,7 +87,7 @@ process_queue(char *queuedir, int dfd)
close(fd);
cur_jobs++;
-end:
+next:
free(name);
free(work);
free(failed);