From: Hwankyu Jhun Date: Thu, 21 Sep 2023 08:31:39 +0000 (+0900) Subject: Fix wrong implmenetation of launchpad library X-Git-Tag: accepted/tizen/8.0/unified/20231005.093035~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F299190%2F2;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Fix wrong implmenetation of launchpad library The argc should be the size of the result of Bundle::Export(). Change-Id: Id4ec0eab4bdec0c750ef9553c001e2620703dffa Signed-off-by: Hwankyu Jhun --- diff --git a/src/lib/launchpad/launchpad_loader.cc b/src/lib/launchpad/launchpad_loader.cc index fdf50fd..2f3faa1 100644 --- a/src/lib/launchpad/launchpad_loader.cc +++ b/src/lib/launchpad/launchpad_loader.cc @@ -328,14 +328,14 @@ void LaunchpadLoader::ProcessLaunchRequest(tizen_base::Parcel* parcel) { 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(calloc(app_argc_, sizeof(char*))); + app_argc_ = exported_args.size(); + app_argv_ = static_cast(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());