SVACE: FIX COMPARE_RESULT_OF_NEW 46/314446/1 accepted/tizen_9.0_unified accepted/tizen_unified_dev accepted/tizen_unified_x_asan tizen_9.0 accepted/tizen/9.0/unified/20241030.233744 accepted/tizen/unified/20240717.060625 accepted/tizen/unified/20241122.010357 accepted/tizen/unified/dev/20240718.035949 accepted/tizen/unified/x/asan/20241224.003728 tizen_9.0_m2_release
authorDongkyun Son <dongkyun.s@samsung.com>
Thu, 11 Jul 2024 22:47:32 +0000 (07:47 +0900)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 11 Jul 2024 22:47:32 +0000 (07:47 +0900)
WGID (210036)
The pointer returned by operator new can't be null, but it's compared with null

Change-Id: Ibc849c5d669f33513eb31296ebf41282c8e5e66e
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
daemon/cpp/inst/AppInst.cpp

index d1e3852f9f46a1027549a8e569c8aa2615d3e770..fbcd17c96e414a31a5269f1b7b3f554f77f9a44d 100644 (file)
@@ -105,20 +105,16 @@ AppInst *AppInst::create(const AppInstInfo &info)
         return 0;
     }
 
-    if (app) {
-        int ret = app->init(info);
-        if (ret) {
-            LOGE("[%s] initialization error, ret=%d\n", type2str(type), ret);
-            delete app;
-            app = 0;
-        }
+    int ret = app->init(info);
+    if (ret) {
+        LOGE("[%s] initialization error, ret=%d\n", type2str(type), ret);
+        delete app;
+        app = 0;
     }
 
-    if (app) {
-        int ret = Anr::add(getAnrName(info));
-        if (ret)
-            LOGE("failed Anr::add: ret=%d\n", ret);
-    }
+    ret = Anr::add(getAnrName(info));
+    if (ret)
+        LOGE("failed Anr::add: ret=%d\n", ret);
 
     return app;
 }
@@ -136,8 +132,6 @@ void AppInst::destroy(AppInst *app)
 int AppInst::init(const AppInstInfo &info)
 {
     _info = new AppInstInfo(info);
-    if (_info == 0)
-        return -ENOMEM;
 
     return doInit();
 }