Memory leak in e100
PATCH 1/1 Memory leak in e100
Hi
This patch fixed a memory leak in the e100 driver. Leak was catched by smatch.
Best regards, Henrik
Please cc, as I'm not subscribed.
drivers/net/e100/e100_main.c +11 -5
@@ -3744,6 +3744,7 @@char *strings =NULL ;char *usr_strings;int i; +int rc =0 ;memset ((void *) &info,0 ,sizeof (info));
@@ -3784,14 +3785,19 @@return -EOPNOTSUPP ; } -if (copy_to_user (ifr->ifr_data, &info,sizeof (info))) -return -EFAULT ; +if (copy_to_user (ifr->ifr_data, &info,sizeof (info))) { + rc = -EFAULT ; + goto exit3; + } -if (copy_to_user (usr_strings, strings, info.len *ETH_GSTRING_LEN )) -return -EFAULT ; +if (copy_to_user (usr_strings, strings, info.len *ETH_GSTRING_LEN )) { + rc = -EFAULT ; + goto exit3; + } +exit3:kfree (strings); -return 0 ; +return rc; } static int