lkml.org 
[lkml]   [2019]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] parport_cs: Fix memory leak in parport_config
Date
From: YueHaibing <yuehaibing@huawei.com>

parport_probe() alloc parport device 'info',
but while parport_config failed it does not free it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/parport/parport_cs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index e9b52e4..e77044c2 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -158,8 +158,9 @@ static int parport_config(struct pcmcia_device *link)
return 0;

failed:
- parport_cs_release(link);
- return -ENODEV;
+ parport_cs_release(link);
+ kfree(link->priv);
+ return -ENODEV;
} /* parport_config */

static void parport_cs_release(struct pcmcia_device *link)
--
2.7.0

\
 
 \ /
  Last update: 2019-03-21 09:27    [W:0.041 / U:11.928 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site