From ef3adf6d159d566d83335cfe55a72206d492d838 Mon Sep 17 00:00:00 2001 From: Jeremie Koenig Date: Tue, 17 Aug 2010 16:48:55 +0000 Subject: 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. --- proclist.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'proclist.c') diff --git a/proclist.c b/proclist.c index 4dd6ab31..16cef9d6 100644 --- a/proclist.c +++ b/proclist.c @@ -63,7 +63,6 @@ proclist_make_node (process_t process) .cleanup = free, }; struct proclist_node *pl; - struct node *np; pl = malloc (sizeof *pl); if (! pl) @@ -72,10 +71,6 @@ proclist_make_node (process_t process) memset (pl, 0, sizeof *pl); pl->process = process; - np = procfs_make_node (&ops, pl); - if (! np) - free (pl); - - return np; + return procfs_make_node (&ops, pl); } -- cgit v1.2.3