This patch fixes the following code-level defects according to static
program analysis result:
1. PROC_USE.VULNERABLE: Use of vulnerable function 'strcpy'. For better
security, using strncpy is recommended instead of strcpy.
2. MEMORY_LEAK.EX: Dynamic memory was allocated by calling function
'calloc' and lost at some point.
Change-Id: Ie58bb7073254935b24257f8c9db19dd04c8b25f8
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
ret = pmqos_unlock_timer_start();
if (ret < 0)
- return ret;
+ goto err;
+
/* Set cpu lock */
set_pmqos(cpu->name, true);
return 0;
+err:
+ if (!found) {
+ DD_LIST_REMOVE(pmqos_head, cpu);
+ free(cpu);
+ }
+
+ return ret;
}
static DBusMessage *dbus_pmqos_handler(E_DBus_Object *obj, DBusMessage *msg)
/* allocate edbus methods structure */
methods = calloc(scenarios.num, sizeof(struct edbus_method));
if (!methods) {
- _E("failed to allocate methods memory : %s", strerror(errno));
+ _E("failed to allocate memory for methods");
pmqos_put_scenario(&scenarios);
return -errno;
}