From 4528d84581123ddd6d0c9c9b9cfe0f88d10aafdf Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 7 Dec 2001 00:35:24 +0000 Subject: 2001-12-06 Roland McGrath * dlabel.c (fd_get_device): Only deallocate NODE if store_create fails. Found by Michael Teichgraeber . --- ufs-utils/dlabel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ufs-utils') 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 @@ -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; } -- cgit v1.2.3