Re: [PATCH] ppdev: don't print a free'd string

From: Sudip Mukherjee
Date: Thu Dec 08 2016 - 17:13:13 EST


On Tuesday 06 December 2016 10:51 AM, Greg Kroah-Hartman wrote:
On Fri, Dec 02, 2016 at 04:23:55PM +0000, Colin King wrote:
From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

A previous fix of a memory leak now prints the string 'name'
that was previously free'd. Fix this by free'ing the string
at the end of the function and adding an error exit path for
the error conditions.

CoverityScan CID#1384523 ("Use after free")

Fixes: 2bd362d5f45c1 ("ppdev: fix memory leak")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
drivers/char/ppdev.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

Sudip, any thoughts?


Hi Greg,

Sorry for the late reply. It looks good.

Acked-by: Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>


Regards
Sudip