return 0;
}
ace_param_list->items = static_cast <ace_param_t *> (malloc(count * sizeof(ace_param_t)));
+ memset(ace_param_list->items, 0, count * sizeof(ace_param_t));
for(size_t i=0; i < count; ++i){
DPL::Deserialization::Deserialize(*stream, name);
- ace_param_list->items[i].name = const_cast <char *> (name.c_str());
+ ace_param_list->items[i].name =
+ strdup(const_cast <char *> (name.c_str()));
DPL::Deserialization::Deserialize(*stream, value);
- ace_param_list->items[i].value = const_cast <char *> (value.c_str());
+ ace_param_list->items[i].value =
+ strdup(const_cast <char *> (value.c_str()));
}
return 0;
}
+static void _ace_params_finalize(ace_param_list_t* ace_param_list) {
+ if (NULL == ace_param_list || ace_param_list->items) {
+ LogDebug("List is null, nothing to do");
+ return;
+ }
+ for (size_t i = 0; i < ace_param_list->count; ++i) {
+ free(ace_param_list->items[i].name);
+ free(ace_param_list->items[i].value);
+ }
+ free(ace_param_list->items);
+ ace_param_list->items = NULL;
+ ace_param_list->count = 0;
+}
+
static void show_popup(struct ace_popup_data *pdp) {
LogDebug("show_popup()");
// ace_widget_handle_t handle
// const ace_param_list_t param_list
-
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-POPUP-BIN");
+ try {
+ DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-POPUP-BIN");
+ } Catch(DPL::Exception) {
+ //cannot run logger
+ return ACE_INTERNAL_ERROR;
+ }
LogDebug("############################ popup binary ################################");
if(argc < 3){
DPL::Deserialization::Deserialize(stream, resource_name_str);
LogDebug("resource_name_char : " << resource_name_str.c_str());
- pdp->resource_name = const_cast <ace_resource_t> (resource_name_str.c_str());
+ pdp->resource_name =
+ strdup(const_cast <ace_resource_t> (resource_name_str.c_str()));
DPL::Deserialization::Deserialize(stream, session_id_str);
LogDebug("session_id_char : " << session_id_str.c_str());
- pdp->session_id = const_cast <ace_session_id_t> (session_id_str.c_str());
+ pdp->session_id =
+ strdup(const_cast <ace_session_id_t> (session_id_str.c_str()));
DPL::Deserialization::Deserialize(stream, handle);
LogDebug("handle_int : " << handle);
// Not calling elm_shutdown() should not have any negative consequences because this binary ends
// in next line, and system should clear the memory.
+ _ace_params_finalize(&(pdp->param_list));
return pdp->validation_return;
}
ELM_MAIN()