Nucleus
Barry Fixed resource leak in VFS c4a1ba4 (3 years, 2 months ago)
diff --git a/include/nucleus/object.h b/include/nucleus/object.h
index b86a86f..139f7ca 100644
--- a/include/nucleus/object.h
+++ b/include/nucleus/object.h
@@ -51,6 +51,7 @@ enum ListMode {
LIST_ORDERED,
};
+int check(void *addr);
void *get(void *addr);
void put(void *addr);
void *new(ObjectType *type);
@@ -58,6 +59,7 @@ void *copy(void *addr);
refcount_t usage(void *addr);
void lock(void *addr);
void unlock(void *addr);
+#define swap_ref(v,o) ({ if (o) get(o); if (v) put(v); v = o; })
ObjectList *create_list(ObjectType *type, enum ListMode mode, ...);
void destroy_list(ObjectList *list);