Powered by Linux
Memory leak warning - false positive — Semantic Matching Tool

Memory leak warning - false positive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a kernel patch that I would like to post upstream. I get a memory leak
warning on it, it is a false positive. See below for a simplified example:

When runing:
$ ~/git/smatch/smatch_scripts/kchecker smatch_test.c 

I get this:

smatch_test.c:11 test() warn: possible memory leak of 'a'
CC      smatch_test.o


On the below trival code:

#include <linux/slab.h>

int test(void)
{
	void *a = kmalloc(1000, GFP_KERNEL);
	bool f = false;

	if (!f)
		kfree(a);

	return 0;
}

Is it a known limitation of smatch? Or maybe I did something silly?

Thanks,
Amir
--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux