diff options
author | Justus Winter <justus@gnupg.org> | 2016-10-05 15:07:37 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2017-09-12 10:41:35 +0200 |
commit | 978a819485e1e301c49b41fb629656d157d61ec6 (patch) | |
tree | 8256f4791623873debe6bd86d2eac2d0a6b1033c | |
parent | 8d5a124be53200c775b818e933603c1c8eeefbe5 (diff) | |
download | hurd-978a819485e1e301c49b41fb629656d157d61ec6.tar.gz hurd-978a819485e1e301c49b41fb629656d157d61ec6.tar.bz2 hurd-978a819485e1e301c49b41fb629656d157d61ec6.zip |
libfshelp: Avoid useless allocations.
* libfshelp/translator-list.c (fshelp_set_active_translator): Avoid
allocating an entry unless a valid control port is given.
-rw-r--r-- | libfshelp/translator-list.c | 4 |
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) { |