Fix memory leak 12/144812/2
authorSeungha Son <seungha.son@samsung.com>
Fri, 18 Aug 2017 04:47:30 +0000 (13:47 +0900)
committerSeungha Son <seungha.son@samsung.com>
Fri, 18 Aug 2017 06:28:39 +0000 (15:28 +0900)
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: Ic777cdeb6517bc87e56d1671cd810edf8babbf5c

src/wgt/step/configuration/step_parse.cc

index a9e3ca1..fbdfb4b 100644 (file)
@@ -32,6 +32,7 @@
 #include <wgt_manifest_handlers/w3c_pc_utils.h>
 
 #include <pkgmgr/pkgmgr_parser.h>
+#include <pkgmgrinfo_basic.h>
 
 #include <string.h>
 
@@ -414,6 +415,7 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
     icon_x* app_icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
     if (!app_icon) {
       LOG(ERROR) << "Out of memory";
+      pkgmgrinfo_basic_free_application(application);
       return false;
     }
     app_icon->text = strdup(icon->text);
@@ -468,6 +470,7 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
       icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
       if (!icon) {
         LOG(ERROR) << "Out of memory";
+        pkgmgrinfo_basic_free_application(application);
         return false;
       }
       icon->text = strdup(icon_path.c_str());
@@ -536,6 +539,7 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) {
       icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
       if (!icon) {
         LOG(ERROR) << "Out of memory";
+        pkgmgrinfo_basic_free_application(application);
         return false;
       }
       icon->text = strdup(app_widget.icon_src.c_str());