Commit 9dc80a74 authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

amd-xgbe: fix potential memory leak in xgbe-debugfs

Added kfree() to avoid the memory leak when debugfs_create_dir() fails.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Acked-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e6740165
...@@ -330,6 +330,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata) ...@@ -330,6 +330,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL); pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
if (!pdata->xgbe_debugfs) { if (!pdata->xgbe_debugfs) {
netdev_err(pdata->netdev, "debugfs_create_dir failed\n"); netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
kfree(buf);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment