Util::SetEnvironments(&app_info_);
auto exported_args = app_info_.GetBundle().Export();
exported_args[0] = app_info_.GetAppPath();
- app_argc_ = exported_args.size() + 1;
- app_argv_ = static_cast<char**>(calloc(app_argc_, sizeof(char*)));
+ app_argc_ = exported_args.size();
+ app_argv_ = static_cast<char**>(calloc(app_argc_ + 1, sizeof(char*)));
if (app_argv_ == nullptr) {
_E("calloc() is failed");
exit(-ENOMEM);
}
- for (int i = 0; i < app_argc_ - 1; ++i) {
+ for (int i = 0; i < app_argc_; ++i) {
app_argv_[i] = strdup(exported_args[i].c_str());
if (app_argv_[i] == nullptr) {
_E("strdup() is failed. [%d] %s", i, exported_args[i].c_str());