     }
     if (script->target) {
        free_pool_memory(script->target);
-@@ -108,60 +122,15 @@
+@@ -108,60 +120,15 @@
  int run_scripts(JCR *jcr, alist *runscripts, const char *label)
  {
     Dmsg2(200, "runscript: running all RUNSCRIPT object (%s) JobStatus=%c\n", label, jcr->JobStatus);

    dst->set_target(src->target);
 
    return dst;   
@@ -95,9 +106,12 @@
 void free_runscript(RUNSCRIPT *script)
 {
    Dmsg0(500, "runscript: freeing RUNSCRIPT object\n");

-   
    target = NULL;
-   command = NULL;
+   commands = NULL;
    on_success = true;
    on_failure = false;
    fail_on_error = true;
@@ -83,10 +86,16 @@
    RUNSCRIPT *dst = (RUNSCRIPT *)malloc(sizeof(RUNSCRIPT));
    memcpy(dst, src, sizeof(RUNSCRIPT));
 
