]> git.sur5r.net Git - bacula/bacula/commitdiff
Try to eliminate possible plugin termination problems
authorKern Sibbald <kern@sibbald.com>
Tue, 25 Nov 2008 07:41:22 +0000 (07:41 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 25 Nov 2008 07:41:22 +0000 (07:41 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8080 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/dir_plugins.c
bacula/src/dird/job.c

index 45ca43af715867ca6b47baaef343829c8f8a7d68..7710b5b1f7e64f6cbeaa2ffc5b9f60f805d66577 100644 (file)
@@ -166,7 +166,10 @@ void free_plugins(JCR *jcr)
    Dmsg2(dbglvl, "Free instance plugin_ctx_list=%p JobId=%d\n", jcr->plugin_ctx_list, jcr->JobId);
    foreach_alist(plugin, plugin_list) {
       /* Free the plugin instance */
-      plug_func(plugin)->freePlugin(&plugin_ctx_list[i++]);
+      plug_func(plugin)->freePlugin(&plugin_ctx_list[i]);
+      plugin_ctx_list[i].bContext = NULL;
+      plugin_ctx_list[i].pContext = NULL;
+      i++;
    }
    free(plugin_ctx_list);
    jcr->plugin_ctx_list = NULL;
index b20c7af0dd3dfe6bdc1fcb40bd07c7bbb125e77d..5ca2141e3d46df75651b6ca1566771624644cd56 100644 (file)
@@ -1023,8 +1023,6 @@ void dird_free_jcr(JCR *jcr)
       jcr->rstore_source = NULL;
    }
 
-   free_plugins(jcr);                 /* release instantiated plugins */
-
    /* Delete lists setup to hold storage pointers */
    free_rwstorage(jcr);
 
@@ -1033,6 +1031,8 @@ void dird_free_jcr(JCR *jcr)
    if (jcr->JobId != 0)
       write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
 
+   free_plugins(jcr);                 /* release instantiated plugins */
+
    Dmsg0(200, "End dird free_jcr\n");
 }