Fix hostap_cs double kfree

From: Eugene Teo
Date: Tue Mar 14 2006 - 21:50:09 EST


prism2_config() kfree's twice if kmalloc fails.

Coverity bug #930

Signed-off-by: Eugene Teo <eugene.teo@xxxxxxxxxxxxx>

--- linux-2.6/drivers/net/wireless/hostap/hostap_cs.c~ 2006-03-15 10:05:36.000000000 +0800
+++ linux-2.6/drivers/net/wireless/hostap/hostap_cs.c 2006-03-15 10:24:53.000000000 +0800
@@ -585,8 +585,6 @@
parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
if (parse == NULL || hw_priv == NULL) {
- kfree(parse);
- kfree(hw_priv);
ret = -ENOMEM;
goto failed;
}
@@ -783,8 +781,10 @@
cs_error(link->handle, last_fn, last_ret);

failed:
- kfree(parse);
- kfree(hw_priv);
+ if (parse)
+ kfree(parse);
+ if (hw_priv)
+ kfree(hw_priv);
prism2_release((u_long)link);
return ret;
}

--
1024D/A6D12F80 print D51D 2633 8DAC 04DB 7265 9BB8 5883 6DAA A6D1 2F80
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/