From 1eeab02e9de4d54178279b347296e98fd97e2a00 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 4 Feb 2013 11:20:58 +0200 Subject: Avoid reusing already freed data. * src/job.c (procspool): Take a pointer to the triplet pointer as a closure data. Return immediately if it is NULL. (wydawca_scanner): Pass a pointer in the second argument in call to for_each_spool. --- src/job.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/job.c b/src/job.c index b49efe3..5dd69c7 100644 --- a/src/job.c +++ b/src/job.c @@ -112,9 +112,13 @@ job_active_count() static int procspool(struct spool *spool, void *data) { + struct file_triplet *trp = *(struct file_triplet **)data; + + if (!trp) + return 0; timer_start("spool"); timer_start(spool->tag); - spool_commit_triplets(spool, (struct file_triplet *)data); + spool_commit_triplets(spool, trp); timer_stop(spool->tag); timer_stop("spool"); return 0; @@ -128,7 +132,7 @@ wydawca_scanner(struct job *job) timer_start("wydawca"); spool_create_timers(); if (job->spool == &inotify_spool) - rc = for_each_spool(procspool, job->triplet_list); + rc = for_each_spool(procspool, &job->triplet_list); else if (job->spool == &fake_spool) rc = scan_all_spools(1, &job->uid); else { @@ -394,4 +398,3 @@ job_init() signal(SIGCHLD, queue_signal); signal(SIGALRM, queue_signal); } - -- cgit v1.2.1