Fix static analysis issue 02/156002/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 17 Oct 2017 02:40:02 +0000 (11:40 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 17 Oct 2017 02:43:29 +0000 (11:43 +0900)
- Check if new operator has failed.

Change-Id: I840874abdac89bb91f6e5aca26df2ac265a541ac
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/wgt/step/configuration/step_parse.cc

index aa62f48..0fe8083 100644 (file)
@@ -200,7 +200,11 @@ bool StepParse::FillIconPaths(manifest_x* manifest) {
     GetManifestDataForKey<const wgt::parse::ApplicationIconsInfo>(
            app_keys::kIconsKey);
   if (!icons_info) {
-    icons_info.reset(new wgt::parse::ApplicationIconsInfo());
+    icons_info.reset(new(std::nothrow) wgt::parse::ApplicationIconsInfo());
+    if (!icons_info) {
+      LOG(ERROR) << "Out of memory";
+      return false;
+    }
   }
   wgt::parse::LocalizedApplicationIconsInfo localized_list =
       wgt::parse::GetLocalizedIconList(*icons_info, widget_path_);
@@ -867,7 +871,11 @@ common_installer::Step::Status StepParse::process() {
     return common_installer::Step::Status::MANIFEST_NOT_FOUND;
   }
 
-  parser_.reset(new wgt::parse::WidgetConfigParser());
+  parser_.reset(new(std::nothrow) wgt::parse::WidgetConfigParser());
+  if (!parser_) {
+    LOG(ERROR) << "Out of memory";
+    return common_installer::Step::Status::CONFIG_ERROR;
+  }
   if (!parser_->ParseManifest(widget_path_ / kConfigFileName)) {
     LOG(ERROR) << "[Parse] Parse failed. " <<  parser_->GetErrorMessage();
     return common_installer::Step::Status::PARSE_ERROR;