From 9e82efac9f4762a1459305e925dfb9a2c48e8a8b Mon Sep 17 00:00:00 2001
From: =?utf8?q?=E2=80=9CJIBAN?=
Date: Wed, 26 Jul 2017 11:25:50 +0530
Subject: [PATCH] USB: Fixed memory leak in usbhost_get_contents()
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
[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
Signed-off-by: Hyotaek Shim
---
src/usb/usb-device.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/usb/usb-device.c b/src/usb/usb-device.c
index 22b2cc4..d254286 100755
--- a/src/usb/usb-device.c
+++ b/src/usb/usb-device.c
@@ -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;
}
--
2.7.4