From 67c1a80ceefa37094e67871262bbed2bd5a81d10 Mon Sep 17 00:00:00 2001 From: "keewook.lee" Date: Wed, 5 Sep 2012 19:57:22 +0900 Subject: Fix the memory leak. change the function. Change-Id: I3988b541e3fe02e462f4bf39bdf5719516fee6a0 Signed-off-by: keewook.lee --- src/device_manager_plugin_exynos.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/device_manager_plugin_exynos.c') diff --git a/src/device_manager_plugin_exynos.c b/src/device_manager_plugin_exynos.c index d95d31a..4a13376 100644 --- a/src/device_manager_plugin_exynos.c +++ b/src/device_manager_plugin_exynos.c @@ -29,6 +29,7 @@ #define BUFF_MAX 255 #define MAX_NAME 255 +#if 0 #define GENERATE_ACCESSORS_CHAR_RW(_suffix, _item) \ char *OEM_sys_get_##_suffix() \ { \ @@ -51,6 +52,7 @@ int OEM_sys_set_##_suffix(char *str) \ { \ return sys_set_str(_item, str); \ } +#endif /* TODO: Add APIs has (char *) params */ @@ -670,13 +672,13 @@ static char *health_text[] = { int OEM_sys_get_battery_health(int *value) { - char *buf; + char buf[BUFF_MAX] = {0}; + int ret = 0; int i = 0; - buf = sys_get_str(BATTERY_HEALTH_PATH); - if (NULL == buf) { + ret = sys_get_str(BATTERY_HEALTH_PATH, buf); + if (ret == -1) return -1; - } for (i = 0; i < BATTERY_HEALTH_MAX; i++) { if (strncmp(buf, health_text[i], strlen(health_text[i])) == 0) { @@ -731,12 +733,12 @@ static int OEM_sys_muic_node_path_info() int OEM_sys_get_uart_path(int *value) { - char *buf; + char buf[BUFF_MAX] = {0}; + int ret = 0; - buf = sys_get_str(uart_node_path); - if (NULL == buf) { + ret = sys_get_str(uart_node_path, buf); + if (ret == -1) return -1; - } if (strncmp(buf, "CP", 2) == 0) { *value = PATH_CP; @@ -764,12 +766,12 @@ int OEM_sys_set_uart_path(int value) int OEM_sys_get_usb_path(int *value) { - char *buf; + char buf[BUFF_MAX] = {0}; + int ret = 0; - buf = sys_get_str(usb_node_path); - if (NULL == buf) { + ret = sys_get_str(usb_node_path, buf); + if (ret == -1) return -1; - } if (strncmp(buf, "PDA", 3) == 0) { *value = PATH_AP; -- cgit v1.2.3