USB: Fixed memory leak in usbhost_get_contents() 96/140696/7
author“JIBAN <p.jiban@samsung.com>
Wed, 26 Jul 2017 05:55:50 +0000 (11:25 +0530)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 30 Mar 2018 01:33:36 +0000 (01:33 +0000)
[Model] COMMON
[BinType] AP
[Customer] OPEN

[Issue#] NA
[Request] NA
[Occurrence Version] NA

[Problem]  Memory Leak.
[Cause & Measure] Fixed memory leak
[Checking Method] NA

[Team] system framework
[Developer] Jiban Prakash
[Solution company] Samsung
[Change Type] Change

Change-Id: Ie6bb20406b0a5708516936f1f27c4a84e1735bb3
Signed-off-by: “JIBAN <p.jiban@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
src/usb/usb-device.c

index 22b2cc4..d254286 100755 (executable)
@@ -162,10 +162,12 @@ static int usbhost_get_contents(bundle *b, char *content, unsigned int len)
        }
 
        text = gl_text_get(0);
-       snprintf(content, len, text, app_id);
-       if (app_id)
-               free(app_id);
+       if (text) {
+               snprintf(content, len, text, app_id);
+               free(text);
+       }
 
+       free(app_id);
        return 0;
 }