Permalink
Browse files

Fix some memory leaks.

Thanks to Ask Bjørn Hansen for reporting the leaks and to valgrind for
finding them.
  • Loading branch information...
kr committed Nov 29, 2009
1 parent f305a98 commit 85c6f7bc2e879f1f7eda3e473a55a689f8ff0c65
Showing with 4 additions and 0 deletions.
  1. +1 −0 job.c
  2. +3 −0 prot.c
View
1 job.c
@@ -87,6 +87,7 @@ rehash()
store_job(j);
}
}
+ free(old);
}
job
View
3 prot.c
@@ -971,6 +971,9 @@ do_stats(conn c, fmt_fn fmt, void *data)
c->out_job = allocate_job(stats_len); /* fake job to hold stats data */
if (!c->out_job) return reply_serr(c, MSG_OUT_OF_MEMORY);
+ /* Mark this job as a copy so it can be appropriately freed later on */
+ c->out_job->state = JOB_STATE_COPY;
+
/* now actually format the stats data */
r = fmt(c->out_job->body, stats_len, data);
/* and set the actual body size */

0 comments on commit 85c6f7b

Please sign in to comment.