ir: fix mem leak issue when probe [1/1]
authorQianggui Song <qianggui.song@amlogic.com>
Fri, 9 Aug 2019 07:53:05 +0000 (15:53 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 16 Aug 2019 02:45:39 +0000 (19:45 -0700)
PD#SWPL-12483

Problem:
during probe stage, some unused mems are not be freed.

Solution:
free mem after using.

Verify:
gxl_p212

Change-Id: I24a91d81f0db9fb1edbab8f63b4e8c7f940d5947
Signed-off-by: Qianggui Song <qianggui.song@amlogic.com>
drivers/amlogic/input/remote/remote_meson.c

index 16c81f1..7f6f430 100644 (file)
@@ -523,6 +523,13 @@ static int get_custom_tables(struct device_node *node,
        for (index = 0; index < chip->custom_num; index++) {
                propname = kasprintf(GFP_KERNEL, "map%d", index);
                phandle = of_get_property(custom_maps, propname, NULL);
+
+               /* never use below, just use to find phandle
+                * mem leak occurs if not free
+                */
+               kfree(propname);
+               propname = NULL;
+
                if (!phandle) {
                        dev_err(chip->dev, "%s:don't find match map%d\n",
                                        __func__, index);