summaryrefslogtreecommitdiff
path: root/libfshelp
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-11-20 12:46:56 +0100
committerJustus Winter <justus@gnupg.org>2016-09-04 14:35:27 +0200
commit3f38f1b21cffcf669373baff46840ce0a7d902e5 (patch)
treecaa4baed1ed9d8595ba25e57c4156800115b3d37 /libfshelp
parentedb2947461fbea9b25a651afd1cf35dc49733ce6 (diff)
libfshelp: acquire references to control ports
* libfshelp/translator-list.c (translator_ihash_cleanup): Release reference. (fshelp_set_active_translator): Acquire reference
Diffstat (limited to 'libfshelp')
-rw-r--r--libfshelp/translator-list.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c
index c87bbaa3..e043a670 100644
--- a/libfshelp/translator-list.c
+++ b/libfshelp/translator-list.c
@@ -53,8 +53,7 @@ translator_ihash_cleanup (void *element, void *arg)
if (translator->pi)
ports_port_deref (translator->pi);
- /* No need to deallocate translator->active, we only keep the name of
- the port, not a reference. */
+ mach_port_deallocate (mach_task_self (), translator->active);
free (translator->name);
free (translator);
}
@@ -124,8 +123,10 @@ fshelp_set_active_translator (struct port_info *pi,
t->pi = pi;
}
- /* No need to increment the reference count, we only keep the
- name, not a reference. */
+ if (MACH_PORT_VALID (t->active))
+ mach_port_deallocate (mach_task_self (), t->active);
+ mach_port_mod_refs (mach_task_self (), active,
+ MACH_PORT_RIGHT_SEND, +1);
t->active = active;
}
else