summaryrefslogtreecommitdiff
path: root/procfs_dir.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-17 16:48:55 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:14:48 +0200
commitac75e3648e6a9c3a8cf45d5fa491abd3a3ab3613 (patch)
tree42afd9455d4384b82a70625ec8b7194d4a08efda /procfs_dir.c
parent3907bbbcfb806799a5349e46a2b804307a0e9836 (diff)
Fix the failure semantics of procfs_make_node
* procfs.c (procfs_make_node): Invoke the cleanup callback on failure, so that callers don't have to. * procfs.h: Document the change. * procfs_dir.c (procfs_dir_make_node), procfs_file.c (procfs_file_make_node), proclist.c (proclist_make_node): Update to reflect the change.
Diffstat (limited to 'procfs_dir.c')
-rw-r--r--procfs_dir.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/procfs_dir.c b/procfs_dir.c
index 4d4faa2..62a45b1 100644
--- a/procfs_dir.c
+++ b/procfs_dir.c
@@ -61,7 +61,6 @@ procfs_dir_make_node (const struct procfs_dir_entry *entries, void *dir_hook)
.cleanup = free,
};
struct procfs_dir_node *dn;
- struct node *np;
dn = malloc (sizeof *dn);
if (! dn)
@@ -70,10 +69,6 @@ procfs_dir_make_node (const struct procfs_dir_entry *entries, void *dir_hook)
dn->entries = entries;
dn->hook = dir_hook;
- np = procfs_make_node (&ops, dn);
- if (! np)
- free (dn);
-
- return np;
+ return procfs_make_node (&ops, dn);
}