PCI hotplug: fix memory leaks
authorJiri Slaby <jslaby@suse.cz>
Wed, 6 Jan 2010 16:47:56 +0000 (17:47 +0100)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 23 Feb 2010 00:16:57 +0000 (16:16 -0800)
Stanse found a cut&pasted memory leak in pciehp_queue_pushbutton_work
and shpchp_queue_pushbutton_work. info is not freed/assigned on all
paths. Fix that.

Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/hotplug/shpchp_ctrl.c

index d6ac1b261dd9d8b9a94185c93006b9739ea04305..9a7f247e8ac155e164158da9fe13fe8b8a640b2c 100644 (file)
@@ -341,6 +341,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
                p_slot->state = POWERON_STATE;
                break;
        default:
+               kfree(info);
                goto out;
        }
        queue_work(pciehp_wq, &info->work);
index 179b1c1cb99bf605f4c83fdfb4b734683da8bfdf..3bba0c0888ff180100d1d8ee1c2e58cbcf5dda73 100644 (file)
@@ -453,6 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
                p_slot->state = POWERON_STATE;
                break;
        default:
+               kfree(info);
                goto out;
        }
        queue_work(shpchp_wq, &info->work);