slic_card_locate does a kzalloc of physcard, and if it fails,
in my previous patch i returned -ENOMEM, but left the driver leak
the memory if card_hostid == SLIC_HOSTID_DEFAULT,
fix this memory leak if the above condition is true
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (!physcard) {
/* no structure allocated for this physical card yet */
physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
- if (!physcard)
+ if (!physcard) {
+ if (card_hostid == SLIC_HOSTID_DEFAULT)
+ kfree(card);
return -ENOMEM;
+ }
physcard->next = slic_global.phys_card;
slic_global.phys_card = physcard;