summaryrefslogtreecommitdiff
path: root/libfshelp
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-05 15:07:37 +0200
committerJustus Winter <justus@gnupg.org>2017-09-12 10:41:35 +0200
commit978a819485e1e301c49b41fb629656d157d61ec6 (patch)
tree8256f4791623873debe6bd86d2eac2d0a6b1033c /libfshelp
parent8d5a124be53200c775b818e933603c1c8eeefbe5 (diff)
libfshelp: Avoid useless allocations.
* libfshelp/translator-list.c (fshelp_set_active_translator): Avoid allocating an entry unless a valid control port is given.
Diffstat (limited to 'libfshelp')
-rw-r--r--libfshelp/translator-list.c4
1 files changed, 4 insertions, 0 deletions
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)
{