Fix some issues found by static analysis. 97/216797/1
authorMichal Bloch <m.bloch@samsung.com>
Mon, 23 Sep 2019 13:12:52 +0000 (15:12 +0200)
committersanghyeok oh <sanghyeok.oh@samsung.com>
Fri, 1 Nov 2019 08:05:29 +0000 (08:05 +0000)
Change-Id: I8af3cddac48f82d98d9bdeaf6d41bae31d3dc12a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
(cherry picked from commit 78eec0949fe14bffe6e057e79c3cf311499be8c3)

src/internal/transaction_guard.hpp
src/libdbuspolicy1.cpp

index dec307f..9df2600 100644 (file)
@@ -42,7 +42,7 @@ public:
        }
 
        Guard(Guard &&g) : fun(std::move(g.fun)), active(g.active) {
-               dismiss();
+               g.dismiss();
        }
 };
 
index 404dad7..1c8f2c3 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/limits.h>
 #include <memory>
 #include <mutex>
+#include <new>
 #include <pwd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -191,7 +192,7 @@ public:
 
        static inline kconn *get_shared(BusType bus_type, int fd)
        {
-               kconn *result = new kconn(Checker::get(bus_type).checker(), fd);
+               kconn *result = new (std::nothrow) kconn(Checker::get(bus_type).checker(), fd);
                if (nullptr == result)
                        LOGE("Error: failed to allocate memory for policy configuration");
                return result;