Fixing memory leaks in kernel/object