Nucleus
Barry Fixed resource leak in VFS c4a1ba4 (3 years, 2 months ago)
diff --git a/object/list.c b/object/list.c
index 01f6aef..6745f28 100644
--- a/object/list.c
+++ b/object/list.c
@@ -7,9 +7,9 @@
*/
#include <stdarg.h>
+#include <nucleus/kernel.h>
#include <nucleus/object.h>
#include <nucleus/memory.h>
-#include <nucleus/panic.h>
/* Structure for a List Entry */
struct ListEntry {
@@ -144,7 +144,8 @@ remove(ObjectList *list, void *addr)
entry->next->prev = entry->prev;
/* Release resources */
- put(obj);
+ if (__builtin_expect(!!(obj->usage), 1))
+ put(obj);
list->entries--;
kfree(entry);
release(&list->lock);