summaryrefslogtreecommitdiff
path: root/ufs-utils
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-12-07 00:35:24 +0000
committerRoland McGrath <roland@gnu.org>2001-12-07 00:35:24 +0000
commitce5b1c54eca565115256b770d4aaf61a6892db01 (patch)
tree4ad1b2f80300c4fed8f76dc4606b1a3f921d7136 /ufs-utils
parent6ff65bacaaf1b6e86a16eacadbe60c511098968a (diff)
2001-12-06 Roland McGrath <roland@frob.com>
* dlabel.c (fd_get_device): Only deallocate NODE if store_create fails. Found by Michael Teichgraeber <gnubert@web.de>.
Diffstat (limited to 'ufs-utils')
-rw-r--r--ufs-utils/dlabel.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ufs-utils/dlabel.c b/ufs-utils/dlabel.c
index 1bb30bbc..355cb3f6 100644
--- a/ufs-utils/dlabel.c
+++ b/ufs-utils/dlabel.c
@@ -1,6 +1,6 @@
/* Get the disklabel from a device node
- Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996,99,2001 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
@@ -43,7 +43,7 @@ fd_get_device (int fd, device_t *device)
if (node == MACH_PORT_NULL)
return errno;
- err = store_create (node, 0, 0, &store);
+ err = store_create (node, 0, 0, &store); /* consumes NODE on success */
if (! err)
{
if (store->class->id != STORAGE_DEVICE
@@ -63,8 +63,8 @@ fd_get_device (int fd, device_t *device)
}
store_free (store);
}
-
- mach_port_deallocate (mach_task_self (), node);
+ else
+ mach_port_deallocate (mach_task_self (), node);
return err;
}