driver core/platform_device_add_resources: free resource before overwriting
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 20 Apr 2011 07:44:45 +0000 (09:44 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 23 Apr 2011 00:09:13 +0000 (17:09 -0700)
Reviewed-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/platform.c

index 667f282f8b7bfe08093a8fe668439442279f3357..7d4bdaf557cff469f0c8c1fd60cbeeeb7829790f 100644 (file)
@@ -200,6 +200,7 @@ int platform_device_add_resources(struct platform_device *pdev,
                        return -ENOMEM;
        }
 
+       kfree(pdev->resource);
        pdev->resource = r;
        pdev->num_resources = num;
        return 0;