tizen_base::Parcel p;
p.WriteParcelable(*parcel_.get());
std::vector<uint8_t> raw = p.GetRaw();
- char *locale = _get_system_locale();
- if (locale == nullptr)
+ std::unique_ptr<char, decltype(std::free)*> locale(
+ _get_system_locale(), std::free);
+ if (locale.get() == nullptr)
return false;
- handler->HandleRequest(&raw[0], raw.size(), locale);
- free(locale);
+ handler->HandleRequest(&raw[0], raw.size(), locale.get());
auto result = handler->ExtractResult();
if (result.size() == 0) return true;
thread_pool_ = std::make_unique<WorkerThread>(thread_num_);
sid_ = g_unix_fd_add(server_->GetFd(), G_IO_IN, OnReceiveRequest, this);
vconf_notify_key_changed(VCONFKEY_LANGSET, OnLanguageChange, this);
- char *locale = _get_system_locale();
- if (locale == nullptr)
+ std::unique_ptr<char, decltype(std::free)*> locale(
+ _get_system_locale(), std::free);
+ if (locale.get() == nullptr)
return;
- thread_pool_->SetLocale(locale);
- free(locale);
+ thread_pool_->SetLocale(locale.get());
LOGI("Start Runner");
}
void Runner::OnLanguageChange(keynode_t* key, void* user_data) {
auto runner = static_cast<Runner*>(user_data);
- char *locale = _get_system_locale();
- if (locale == nullptr)
+ std::unique_ptr<char, decltype(std::free)*> locale(
+ _get_system_locale(), std::free);
+ if (locale.get() == nullptr)
return;
- runner->thread_pool_->SetLocale(locale);
- free(locale);
+ runner->thread_pool_->SetLocale(locale.get());
}
bool Runner::QueueRequest(int client_fd) {