X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/fwd/blobdiff_plain/755e6619263d316dc46fa504e0c333c963ec8eaa..57ceb980e3c55306f3f70f92604703abf132cf27:/exec.c diff --git a/exec.c b/exec.c index d41a31d..fc8b679 100644 --- a/exec.c +++ b/exec.c @@ -1004,6 +1004,8 @@ static source *xsource_read(scanner *sc) return (0); xs = CREATE(xsource); xs->s.ops = &xsource_ops; + xs->s.ref = 1; + xs->s.f = 0; xs->s.desc = 0; exec_read(&xs->x, sc); return (&xs->s); @@ -1032,18 +1034,12 @@ static void xsource_attach(source *s, scanner *sc, target *t) /* --- Create the endpoints --- */ if ((ee = t->ops->create(t, xs->s.desc)) == 0) - goto tidy; + return; if ((e = exec_endpt(&xs->x, xs->s.desc)) == 0) { ee->ops->close(ee); - goto tidy; + return; } endpt_join(e, ee, xs->s.desc); - - /* --- Dispose of source and target --- */ - -tidy: - t->ops->destroy(t); - xsource_destroy(&xs->s); } /* --- @destroy@ --- */ @@ -1060,7 +1056,7 @@ static void xsource_destroy(source *s) source_ops xsource_ops = { "exec", - xsource_option, xsource_read, xsource_attach, xsource_destroy + xsource_option, xsource_read, xsource_attach, 0, xsource_destroy }; /*----- Exec target description -------------------------------------------*/ @@ -1084,6 +1080,7 @@ static target *xtarget_read(scanner *sc) return (0); xt = CREATE(xtarget); xt->t.ops = &xtarget_ops; + xt->t.ref = 1; exec_read(&xt->x, sc); exec_desc(&xt->x, &d); xt->t.desc = xstrdup(d.buf);