From 9dc80a74313d2741e053a650942818a86f234fc9 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 30 Sep 2015 03:48:50 -0700 Subject: amd-xgbe: fix potential memory leak in xgbe-debugfs Added kfree() to avoid the memory leak when debugfs_create_dir() fails. Signed-off-by: Geliang Tang Acked-by: Tom Lendacky Signed-off-by: David S. Miller --- drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ethernet/amd') diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c index 2c063b60db4b..66137ffea3f8 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c @@ -330,6 +330,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); if (!pdata->xgbe_debugfs) { netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); + kfree(buf); return; } -- cgit v1.2.3