summaryrefslogtreecommitdiffstats
path: root/job.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-11 07:30:07 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-11 07:30:07 +0000
commitabedfa77daf3b8a815b134e3650bece0bb646631 (patch)
treeeac8ae85faf791921061e6f6498eee44103c9b7d /job.c
parentff4b4e667a64b30e4323df4b0e1637fc7ebae6c1 (diff)
There isn't much point in having a free function if it isn't used.
Also allow a NULL tree.
Diffstat (limited to 'job.c')
-rw-r--r--job.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/job.c b/job.c
index df515b37..15155bb3 100644
--- a/job.c
+++ b/job.c
@@ -107,7 +107,8 @@ job_add(struct jobs *jobs, struct client *c, const char *cmd,
job->flags = JOB_DONE;
- RB_INSERT(jobs, jobs, job);
+ if (jobs != NULL)
+ RB_INSERT(jobs, jobs, job);
SLIST_INSERT_HEAD(&all_jobs, job, lentry);
return (job);
@@ -121,6 +122,9 @@ job_free(struct job *job)
xfree(job->cmd);
+ if (job->freefn != NULL && job->data != NULL)
+ job->freefn(job->data);
+
if (job->fd != -1)
close(job->fd);
if (job->out != NULL)