diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-05-06 01:05:22 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-05-06 01:05:22 +0200 |
commit | c290af8a3203ce9897574b381c4d1fa2977c315d (patch) | |
tree | f974fb64fa82f01c516dbb4f877c5ee058f2c28e | |
parent | e1ed372bc7e259f1371f7a4acb233f1000f772ff (diff) |
Fix port leak
* libtrivfs/file-reparent.c (trivfs_S_file_reparent): Deallocate `parent'
port when the trivfs_S_io_duplicate() call succeeds.
-rw-r--r-- | libtrivfs/file-reparent.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libtrivfs/file-reparent.c b/libtrivfs/file-reparent.c index c07fbccb..0682a912 100644 --- a/libtrivfs/file-reparent.c +++ b/libtrivfs/file-reparent.c @@ -27,5 +27,8 @@ trivfs_S_file_reparent (struct trivfs_protid *cred, mach_port_t *new, mach_msg_type_name_t *new_type) { /* This is not a directory, so we just duplicate it */ - return trivfs_S_io_duplicate (cred, reply, reply_type, new, new_type); + error_t ret = trivfs_S_io_duplicate (cred, reply, reply_type, new, new_type); + if (!ret) + mach_port_deallocate (mach_task_self (), parent); + return ret; } |