diff options
author | Roland McGrath <roland@gnu.org> | 2001-12-07 00:35:24 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-12-07 00:35:24 +0000 |
commit | 4528d84581123ddd6d0c9c9b9cfe0f88d10aafdf (patch) | |
tree | 85871cbd46bbc7fd55718cfd6c5b7255405d2c1c | |
parent | e3be7128862f0c2c2eda846d6be149cf4d2732d9 (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>.
-rw-r--r-- | ufs-utils/dlabel.c | 8 |
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; } |