From 0961b79a97836e41ccce54b07c89233d7b6445ab Mon Sep 17 00:00:00 2001 From: Michal Bloch Date: Mon, 23 Sep 2019 15:12:52 +0200 Subject: [PATCH] Fix some issues found by static analysis. Change-Id: I8af3cddac48f82d98d9bdeaf6d41bae31d3dc12a Signed-off-by: Michal Bloch (cherry picked from commit 78eec0949fe14bffe6e057e79c3cf311499be8c3) --- src/internal/transaction_guard.hpp | 2 +- src/libdbuspolicy1.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/internal/transaction_guard.hpp b/src/internal/transaction_guard.hpp index dec307f..9df2600 100644 --- a/src/internal/transaction_guard.hpp +++ b/src/internal/transaction_guard.hpp @@ -42,7 +42,7 @@ public: } Guard(Guard &&g) : fun(std::move(g.fun)), active(g.active) { - dismiss(); + g.dismiss(); } }; diff --git a/src/libdbuspolicy1.cpp b/src/libdbuspolicy1.cpp index 404dad7..1c8f2c3 100644 --- a/src/libdbuspolicy1.cpp +++ b/src/libdbuspolicy1.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -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; -- 2.7.4