Fix issues detected by svace 07/193807/4
authorOskar Chodowicz <o.chodowicz@samsung.com>
Mon, 26 Nov 2018 11:42:41 +0000 (12:42 +0100)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Tue, 27 Nov 2018 12:03:58 +0000 (13:03 +0100)
Change-Id: Icdfa44aca13924c4e73e5cf7345fea6ed8857433

src/Atspi.hpp
src/batch/Dlog.cpp
tests/no-ui-scenarios/DBusTests.cpp
tests/no-ui-scenarios/OptionalTests.cpp

index 845af0e..9cb753e 100644 (file)
@@ -930,7 +930,7 @@ public:
        {
                friend class Atspi;
                friend class std::default_delete<WatchHandler>;
-               Atspi *atspi;
+               Atspi *atspi = nullptr;
                size_t index = 0;
 
                WatchHandler() = default;
index f188843..eaa3fdb 100644 (file)
@@ -129,8 +129,13 @@ bool Dlog::start()
                                        DEBUG("spurious wake...");
                                }
                        }
-                       close(closingFd);
-                       close(dlogFile);
+
+                       if (close(closingFd) == -1)
+                               WARNING("Failed to close pipes");
+
+                       if (close(dlogFile) == -1)
+                               WARNING("Failed to close file");
+
                } };
        return true;
 }
index 391b6d9..efc2551 100644 (file)
@@ -680,7 +680,9 @@ int main(int argc, char *argv[])
                        DEBUG("exception");
                        r = 1;
                }
-               kill(c, 9);
+               if (kill(c, 9) == -1)
+                       WARNING("failed to kill: %d", c);
+
                return r;
        } else {
                ASSERT(0, "failed to fork");
index f08cd86..0b637d8 100644 (file)
@@ -68,6 +68,8 @@ public:
                ClassWithCounters &operator = (const ClassWithCounters &other)
                {
                        ++assignmentCallsCount;
+                       if (&other == this)
+                               return *this;
                        value = other.value;
                        return *this;
                }
@@ -75,6 +77,8 @@ public:
                ClassWithCounters &operator = (ClassWithCounters &&other)
                {
                        ++assignmentCallsCount;
+                       if (&other == this)
+                               return *this;
                        value = other.value;
                        return *this;
                }