summaryrefslogtreecommitdiff
path: root/libdiskfs/node-make.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-05-05 03:27:11 +0000
committerRoland McGrath <roland@gnu.org>2002-05-05 03:27:11 +0000
commitfc2b2e8e4f9a53c905a8c204cf83dd0665a0c8df (patch)
treedfde5778e54dee9ce3511edf9b174893b77e574e /libdiskfs/node-make.c
parenteaf9ce9d05ea93ea5032a054245033efd93c9e67 (diff)
2002-04-02 Roland McGrath <roland@frob.com>
* node-make.c (diskfs_make_node): Return early if malloc fails.
Diffstat (limited to 'libdiskfs/node-make.c')
-rw-r--r--libdiskfs/node-make.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libdiskfs/node-make.c b/libdiskfs/node-make.c
index ca5119a0..79c2890c 100644
--- a/libdiskfs/node-make.c
+++ b/libdiskfs/node-make.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+/*
+ Copyright (C) 1994,95,96,2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -25,13 +25,16 @@ struct node *
diskfs_make_node (struct disknode *dn)
{
struct node *np = malloc (sizeof (struct node));
-
+
+ if (np == 0)
+ return 0;
+
np->dn = dn;
np->dn_set_ctime = 0;
np->dn_set_atime = 0;
np->dn_set_mtime = 0;
np->dn_stat_dirty = 0;
-
+
mutex_init (&np->lock);
np->references = 1;
np->light_references = 0;
@@ -40,11 +43,10 @@ diskfs_make_node (struct disknode *dn)
np->dirmod_reqs = 0;
np->filemod_reqs = 0;
-
+
fshelp_transbox_init (&np->transbox, &np->lock, np);
iohelp_initialize_conch (&np->conch, &np->lock);
fshelp_lock_init (&np->userlock);
-
return np;
}