Commit be4ea8f3 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: r8188eu: fix a memory leak in rtw_wx_read32()

Free "ptmp" before returning -EINVAL.

Fixes: 2b42bd58 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211109114935.GC16587@kiliSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4a293eaf
...@@ -1980,6 +1980,7 @@ static int rtw_wx_read32(struct net_device *dev, ...@@ -1980,6 +1980,7 @@ static int rtw_wx_read32(struct net_device *dev,
u32 data32; u32 data32;
u32 bytes; u32 bytes;
u8 *ptmp; u8 *ptmp;
int ret;
padapter = (struct adapter *)rtw_netdev_priv(dev); padapter = (struct adapter *)rtw_netdev_priv(dev);
p = &wrqu->data; p = &wrqu->data;
...@@ -2007,12 +2008,17 @@ static int rtw_wx_read32(struct net_device *dev, ...@@ -2007,12 +2008,17 @@ static int rtw_wx_read32(struct net_device *dev,
break; break;
default: default:
DBG_88E(KERN_INFO "%s: usage> read [bytes],[address(hex)]\n", __func__); DBG_88E(KERN_INFO "%s: usage> read [bytes],[address(hex)]\n", __func__);
return -EINVAL; ret = -EINVAL;
goto err_free_ptmp;
} }
DBG_88E(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, extra); DBG_88E(KERN_INFO "%s: addr = 0x%08X data =%s\n", __func__, addr, extra);
kfree(ptmp); kfree(ptmp);
return 0; return 0;
err_free_ptmp:
kfree(ptmp);
return ret;
} }
static int rtw_wx_write32(struct net_device *dev, static int rtw_wx_write32(struct net_device *dev,
......
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