]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commit
ARM64: zynqmp: pm: Fix memory leak
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Fri, 10 Mar 2017 00:32:37 +0000 (16:32 -0800)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 10 Mar 2017 09:29:59 +0000 (10:29 +0100)
commiteecac5cbaecc40b6d42681882e181aa2c5bedf0a
tree4b0e32c5a3f668412ea7bf1a796f1507936811ee
parent1d23f835e441a0271cc64a4ce959d39546fb55ea
ARM64: zynqmp: pm: Fix memory leak

There is a memory leak issue in the PM driver.
The function processing user input uses strsep on a kzalloc'd memory
pointer and later kfrees the same pointer.
Since every strsep call modifies the string pointer, it eventually
points to NULL, thereby passing a NULL pointer to kfree, thus causing a
leak.
The solution is to copy the address of kzalloc'd memory in another
pointer, and kfree this instead.

Reported-by: Rohit Fule <rohit.fule@gmail.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/soc/xilinx/zynqmp/pm.c