[PATCH] drm: Fix two memleaks.

majianpeng majianpeng at gmail.com
Tue Mar 12 00:04:24 PDT 2013


Signed-off-by: Jianpeng Ma <majianpeng at gmail.com>
---
 drivers/gpu/drm/drm_edid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index c194f4e..05aa33a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1081,6 +1081,7 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
     new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
     if (!new)
         goto out;
+    kfree(block);
     block = new;
 
     for (j = 1; j <= block[0x7e]; j++) {
@@ -1110,6 +1111,7 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
         new = krealloc(block, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
         if (!new)
             goto out;
+        kfree(block);
         block = new;
     }
 
-- 
1.8.2.rc2.4.g7799588



More information about the dri-devel mailing list