From 4370c33bccc2ef5bddacbd364270aa310f89c94d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 2 Nov 2014 23:06:56 +0100 Subject: Fix unlocking translator list * libfshelp/translator-list.c (fshelp_set_active_translator): Use common out path to unlock translator_ihash_lock before exitting on error. --- libfshelp/translator-list.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libfshelp') diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c index be7ce4de..c87bbaa3 100644 --- a/libfshelp/translator-list.c +++ b/libfshelp/translator-list.c @@ -82,7 +82,10 @@ fshelp_set_active_translator (struct port_info *pi, t = malloc (sizeof (struct translator)); if (! t) - return ENOMEM; + { + err = errno; + goto out; + } t->active = MACH_PORT_NULL; t->pi = NULL; @@ -110,7 +113,7 @@ fshelp_set_active_translator (struct port_info *pi, MACH_MSG_TYPE_MAKE_SEND_ONCE, &old); if (err) - return err; + goto out; if (old != MACH_PORT_NULL) mach_port_deallocate (mach_task_self (), old); -- cgit v1.2.3