MGS-4363 [#imx-1246] fix coverity resource leak issue
authorXianzhong <xianzhong.li@nxp.com>
Fri, 16 Nov 2018 18:19:02 +0000 (02:19 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
CID 3925877: Resource leak (RESOURCE_LEAK)
14. leaked_storage: Variable pages going out of scope leaks the storage it points to.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit a38d1b1ff31ce87a231588de1a2e24a787f87143)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/default/gc_hal_kernel_allocator_user_memory.c

index 3a04df6..7d4c378 100644 (file)
@@ -214,9 +214,9 @@ error:
     kfree(um->sgt.sgl);
 #endif
 
-    if (um->pages)
+    if (pages)
     {
-        kfree(um->pages);
+        kfree(pages);
     }
     return result;
 }