From 7fd5a35d8dac0d535eab1e7b01c88b03b8a542b2 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 21 Jul 1995 20:53:26 +0000 Subject: (diskfs_S_file_getcontrol): Free initial reference created by ports_allocate_port. --- libdiskfs/file-getcontrol.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libdiskfs/file-getcontrol.c b/libdiskfs/file-getcontrol.c index d4580e6c..d7c2676c 100644 --- a/libdiskfs/file-getcontrol.c +++ b/libdiskfs/file-getcontrol.c @@ -25,7 +25,8 @@ diskfs_S_file_getcontrol (struct protid *cred, mach_msg_type_name_t *controltype) { int error = 0;; - + struct port_info *newpi; + if (!cred) return EOPNOTSUPP; @@ -36,11 +37,12 @@ diskfs_S_file_getcontrol (struct protid *cred, spin_lock (&_diskfs_control_lock); _diskfs_ncontrol_ports++; spin_unlock (&_diskfs_control_lock); - *control = ports_get_right (ports_allocate_port - (diskfs_port_bucket, - sizeof (struct port_info), - diskfs_control_class)); + newpi = ports_allocate_port (diskfs_port_bucket, + sizeof (struct port_info), + diskfs_control_class); + *control = ports_get_right (newpi); *controltype = MACH_MSG_TYPE_MAKE_SEND; + ports_port_deref (newpi); } return error; -- cgit v1.2.3