samples/kmemleak/kmemleak-test.c

Source file repositories/reference/linux-study-clean/samples/kmemleak/kmemleak-test.c

File Facts

System
Linux kernel
Corpus path
samples/kmemleak/kmemleak-test.c
Extension
.c
Size
2818 bytes
Lines
103
Domain
Support Tooling And Documentation
Bucket
samples
Inferred role
Support Tooling And Documentation: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

module_init(kmemleak_test_init);

static void __exit kmemleak_test_exit(void)
{
	struct test_node *elem, *tmp;

	/*
	 * Remove the list elements without actually freeing the
	 * memory.
	 */
	list_for_each_entry_safe(elem, tmp, &test_list, list)
		list_del(&elem->list);
}
module_exit(kmemleak_test_exit);

MODULE_DESCRIPTION("Sample module to leak memory for kmemleak testing");
MODULE_LICENSE("GPL");

Annotation

Implementation Notes