MLK-12092: mxc_edid: Free mode buffer before function return
authorSandor Yu <Sandor.yu@nxp.com>
Mon, 28 Dec 2015 09:45:16 +0000 (17:45 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:37 +0000 (14:49 -0500)
Free mode buffer before function return to avoid memory leak.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
drivers/video/fbdev/mxc/mxc_edid.c

index 998b2d4..23110ce 100644 (file)
@@ -578,8 +578,10 @@ int mxc_edid_parse_ext_blk(unsigned char *edid,
 
        m = kmalloc((num + specs->modedb_len) *
                        sizeof(struct fb_videomode), GFP_KERNEL);
-       if (!m)
+       if (!m) {
+               kfree(mode);
                return 0;
+       }
 
        if (specs->modedb_len) {
                memmove(m, specs->modedb,