]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bscan segfault with new comment field
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 4 Apr 2010 07:38:16 +0000 (09:38 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:49:44 +0000 (16:49 +0200)
bacula/src/dird/job.c
bacula/src/dird/ua_run.c
bacula/src/lib/jcr.c

index 36308e8f38557fa9a089bbb409bad5fb5ef2a068..23b5022dbef83dfae144741a0ae8c4fc806fbbc3 100644 (file)
@@ -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);
index be7b5e89a0fe51d1cda8d641cab4cbc238025e3f..97874c431e877e15d80a8d0f3d5147dbc4ed97ba 100644 (file)
@@ -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) {
index 242480f0e5234b52f8356b98ea97dc502f379af9..988566ecfd3fc64d8d33a2a9a750d5ab720be20e 100644 (file)
@@ -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);
 }