return VC_DB_ERROR_NONE;
}
+void __vc_db_demandable_client_free(void* data)
+{
+ vc_deactivated_app_s* d_app = (vc_deactivated_app_s*)data;
+
+ if (NULL != d_app) {
+ if (NULL != d_app->appid) {
+ free(d_app->appid);
+ d_app->appid = NULL;
+ }
+
+ free(d_app);
+ }
+}
+
static int __vc_db_get_appid(const char* result, GSList** app_list)
{
GSList* temp_app_list = NULL;
SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] memory allcation fail");
if (NULL != temp_app_list) {
- g_slist_free_full(temp_app_list, free);
+ g_slist_free_full(temp_app_list, __vc_db_demandable_client_free);
temp_app_list = NULL;
}
db_util_close(db_handle);
db_handle = NULL;
}
+
+ free(path);
+ path = NULL;
return VC_DB_ERROR_OPERATION_FAILED;
}
if (db_handle)
db_util_close(db_handle);
db_handle = NULL;
+
+ free(path);
+ path = NULL;
return VC_DB_ERROR_OPERATION_FAILED;
}
if (db_handle)
db_util_close(db_handle);
db_handle = NULL;
+
+ free(path);
+ path = NULL;
return VC_DB_ERROR_OPERATION_FAILED;
}
ret = regexec(®[4], str, 2, pmatch, 0);
if (0 == ret) {
len = pmatch[1].rm_eo - pmatch[1].rm_so;
- tempstr = strndup(str + pmatch[1].rm_so, len);
+
+ if (0 > len) {
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
+ return VC_ERROR_OPERATION_FAILED;
+ }
+ tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
ret = regexec(®[5], str, 2, pmatch, 0);
if (0 == ret) {
len = pmatch[1].rm_eo - pmatch[1].rm_so;
- tempstr = strndup(str + pmatch[1].rm_so, len);
+
+ if (0 > len) {
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
+ return VC_ERROR_OPERATION_FAILED;
+ }
+ tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
ret = regexec(®[1], str, 2, pmatch, 0);
if (0 == ret) {
len = pmatch[1].rm_eo - pmatch[1].rm_so;
- tempstr = strndup(str + pmatch[1].rm_so, len);
+
+ if (0 > len) {
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
+ return VC_ERROR_OPERATION_FAILED;
+ }
+ tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
idx = 1;
len = pmatch[idx].rm_eo - pmatch[idx].rm_so;
if (0 < len) {
- tempstr = strndup(str + pmatch[idx].rm_so, len);
+ tempstr = strndup(str + pmatch[idx].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
ret = regexec(®[9], str, 2, pmatch, 0);
if (0 == ret) {
len = pmatch[1].rm_eo - pmatch[1].rm_so;
- tempstr = strndup(str + pmatch[1].rm_so, len);
+
+ if (0 > len) {
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
+ return VC_ERROR_OPERATION_FAILED;
+ }
+ tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
if (!m_flag) return -1;
len = pmatch[2].rm_eo - pmatch[2].rm_so;
- tempstr = strndup(str + pmatch[2].rm_so, len);
+
+ if (0 > len) {
+ SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
+ return VC_ERROR_OPERATION_FAILED;
+ }
+ tempstr = strndup(str + pmatch[2].rm_so, (size_t)len);
if (NULL == tempstr) {
SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
return ret;
}
+void __vc_info_parser_demandable_client_free(void* data)
+{
+ vc_demandable_client_s* d_client = (vc_demandable_client_s*)data;
+
+ if (NULL != d_client) {
+ if (NULL != d_client->appid) {
+ free(d_client->appid);
+ d_client->appid = NULL;
+ }
+
+ free(d_client);
+ }
+}
+
int vc_info_parser_get_demandable_clients(GSList** client_list)
{
/* Check file */
SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Memory alloc error!!");
if (NULL != temp_client_list) {
- g_slist_free_full(temp_client_list, free);
+ g_slist_free_full(temp_client_list, __vc_info_parser_demandable_client_free);
temp_client_list = NULL;
}
xmlFree(key);
/* Get handle data from list */
data = iter->data;
iter = g_list_remove(iter, data);
+
+ if (NULL != data) {
+ if (NULL != data->engine_uuid) {
+ free(data->engine_uuid);
+ data->engine_uuid = NULL;
+ }
+ if (NULL != data->engine_name) {
+ free(data->engine_name);
+ data->engine_name = NULL;
+ }
+ if (NULL != data->engine_path) {
+ free(data->engine_path);
+ data->engine_path = NULL;
+ }
+
+ free(data);
+ data = NULL;
+ }
}
}
g_list_free(iter);
+ g_engine_list = NULL;
/* release current engine data */
if (NULL != g_dynamic_engine.pefuncs) {
return 0;
}
-
-
-
-