From: Eric Bollengier Date: Sun, 4 Apr 2010 07:38:16 +0000 (+0200) Subject: Fix bscan segfault with new comment field X-Git-Tag: Release-7.0.0~2000 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b7d2fb1e49aa6f3dad6f02d4a0478f1e342ed83b;p=bacula%2Fbacula Fix bscan segfault with new comment field --- diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 36308e8f38..23b5022dbe 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -139,10 +139,6 @@ bool setup_job(JCR *jcr) goto bail_out; } Dmsg0(150, "DB opened\n"); - if (!jcr->comment) { - jcr->comment = get_pool_memory(PM_MESSAGE); - *jcr->comment = '\0'; - } if (!jcr->fname) { jcr->fname = get_pool_memory(PM_FNAME); } @@ -1034,10 +1030,6 @@ void dird_free_jcr_pointers(JCR *jcr) bnet_close(jcr->store_bsock); jcr->store_bsock = NULL; } - if (jcr->comment) { - free_pool_memory(jcr->comment); - jcr->comment = NULL; - } if (jcr->fname) { Dmsg0(200, "Free JCR fname\n"); free_pool_memory(jcr->fname); diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index be7b5e89a0..97874c431e 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -439,9 +439,6 @@ static bool reset_restore_context(UAContext *ua, JCR *jcr, run_ctx &rc) pm_strcpy(jcr->catalog_source, _("User input")); } - if (!jcr->comment) { - jcr->comment = get_pool_memory(PM_MESSAGE); - } pm_strcpy(jcr->comment, rc.comment); if (rc.where) { diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 242480f0e5..988566ecfd 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -358,6 +358,8 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr) jcr->VolumeName[0] = 0; jcr->errmsg = get_pool_memory(PM_MESSAGE); jcr->errmsg[0] = 0; + jcr->comment = get_pool_memory(PM_FNAME); + jcr->comment[0] = 0; /* Setup some dummy values */ bstrncpy(jcr->Job, "*System*", sizeof(jcr->Job)); jcr->JobId = 0; @@ -469,6 +471,10 @@ static void free_common_jcr(JCR *jcr) free_guid_list(jcr->id_list); jcr->id_list = NULL; } + if (jcr->comment) { + free_pool_memory(jcr->comment); + jcr->comment = NULL; + } remove_jcr_from_tsd(jcr); free(jcr); }