]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/jcr.c
Attempt to fix bat seg faults
[bacula/bacula] / bacula / src / lib / jcr.c
index 05a94d21284fe261854c64caf3488395caac5405..32b6aabd3baa3d4f481c5f66b592bce879b5470a 100644 (file)
@@ -499,7 +499,6 @@ void free_jcr(JCR *jcr)
 
 #endif
 
-   dequeue_messages(jcr);
    lock_jcr_chain();
    jcr->dec_use_count();              /* decrement use count */
    if (jcr->use_count() < 0) {
@@ -520,6 +519,7 @@ void free_jcr(JCR *jcr)
    }
    remove_jcr(jcr);                   /* remove Jcr from chain */
 
+   dequeue_messages(jcr);
    job_end_pop(jcr);                  /* pop and call hooked routines */
 
    Dmsg1(dbglvl, "End job=%d\n", jcr->JobId);
@@ -538,7 +538,7 @@ void free_jcr(JCR *jcr)
          num_jobs_run++;
          je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
          memset(je, 0, sizeof(struct s_last_job));  /* zero in case unset fields */
-         je->Errors = jcr->Errors;
+         je->Errors = jcr->JobErrors;
          je->JobType = jcr->get_JobType();
          je->JobId = jcr->JobId;
          je->VolSessionId = jcr->VolSessionId;