Properly deallocate all ports and terminate the started translator if
an error occurs.
* libfshelp/start-translator-long.c (fshelp_start_translator_long):
Improve error handling.
---
libfshelp/start-translator-long.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libfshelp/start-translator-long.c
b/libfshelp/start-translator-long.c
index 55fb0ff..864726f 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -297,12 +297,17 @@ fshelp_start_translator_long (fshelp_open_fn_t
underlying_open_fn,
bootstrap, MACH_MSG_TYPE_MAKE_SEND_ONCE,
&prev_notify);
if (err)
- return err;
+ {
+ task_terminate (task);
+ goto lose;
+ }
/* Ok, cool, we've got a running(?) program, now rendezvous with it if
possible using the startup protocol on the bootstrap port... */
err = service_fsys_startup(underlying_open_fn, cookie, bootstrap,
timeout, control, task);
+ if (err)
+ task_terminate (task);
lose:
if (!ports_moved)
--
1.7.10.4