From 880dd56f468b57a198ab2136767d03ddaa586eef Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 1 Nov 2013 22:53:12 +0100 Subject: libports: fix error handling in _ports_create_port_internal Previously any err value set before reaching lose: was overwritten and thus not properly propagated. Found using the Clang Static Analyzer. * libports/create-internal.c (_ports_create_port_internal): Fix error handling. --- libports/create-internal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libports') diff --git a/libports/create-internal.c b/libports/create-internal.c index c60f6fd9..572a55a8 100644 --- a/libports/create-internal.c +++ b/libports/create-internal.c @@ -109,10 +109,11 @@ _ports_create_port_internal (struct port_class *class, err = EINTR; lose: pthread_mutex_unlock (&_ports_lock); - lose_unlocked: - err = mach_port_mod_refs (mach_task_self (), port, - MACH_PORT_RIGHT_RECEIVE, -1); - assert_perror (err); + lose_unlocked:; + error_t e; + e = mach_port_mod_refs (mach_task_self (), port, + MACH_PORT_RIGHT_RECEIVE, -1); + assert_perror (e); free (pi); return err; -- cgit v1.2.3