From 978a819485e1e301c49b41fb629656d157d61ec6 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 5 Oct 2016 15:07:37 +0200 Subject: libfshelp: Avoid useless allocations. * libfshelp/translator-list.c (fshelp_set_active_translator): Avoid allocating an entry unless a valid control port is given. --- libfshelp/translator-list.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libfshelp/translator-list.c') diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c index c730ecd1..52031286 100644 --- a/libfshelp/translator-list.c +++ b/libfshelp/translator-list.c @@ -89,6 +89,10 @@ fshelp_set_active_translator (struct port_info *pi, if (t) goto update; /* Entry exists. */ + if (! MACH_PORT_VALID (active)) + /* Avoid allocating an entry just to delete it. */ + goto out; + t = malloc (sizeof *t); if (! t) { -- cgit v1.2.3