Coverity fixes tizen_4.0
authorSaulo Moraes <s.moraes@samsung.com>
Mon, 7 Jan 2019 16:46:00 +0000 (14:46 -0200)
committerSaulo Aldighieri Moraes <s.moraes@samsung.com>
Mon, 7 Jan 2019 16:46:17 +0000 (14:46 -0200)
Change-Id: I3176cbd801e7289bb397379d11f3a99b6eeb16c8

server/src/PrivacyGuardDb.cpp
test/tc-dlp-performance.c

index 3a60fc55be97674d57f1e2d94ff2ae9b04493670..3c05c14270963d0777f2eb1f164bd20f629256b9 100644 (file)
@@ -701,16 +701,16 @@ PrivacyGuardDb::PgForeachPrivacyCountByPrivacyId(const int userId, const int sta
 
        // bind
        res = sqlite3_bind_int(m_stmt, 1, userId);
-       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_int : %d", res);
+       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, m_dbMutex.unlock(), "sqlite3_bind_int : %d", res);
 
        res = sqlite3_bind_text(m_stmt, 2, privacyId.c_str(), -1, SQLITE_TRANSIENT);
-       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);
+       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, m_dbMutex.unlock(), "sqlite3_bind_text : %d", res);
 
        res = sqlite3_bind_int(m_stmt, 3, startDate);
-       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_int : %d", res);
+       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, m_dbMutex.unlock(), "sqlite3_bind_int : %d", res);
 
        res = sqlite3_bind_int(m_stmt, 4, endDate);
-       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, , "sqlite3_bind_int : %d", res);
+       TryReturn(res == SQLITE_OK, PRIV_GUARD_ERROR_DB_ERROR, m_dbMutex.unlock(), "sqlite3_bind_int : %d", res);
 
        while ((res = sqlite3_step(m_stmt)) == SQLITE_ROW) {
                const char* packageId =  reinterpret_cast < const char* > (sqlite3_column_text(m_stmt, 0));
index 3c1e61445e756bd660fbfaaca48a4d1a904216c0..c6be6a81abd616bcb6084de4feb71a8bbd4bd3fb 100644 (file)
@@ -335,6 +335,7 @@ static void __test_privacy_guard_client_dlp_string_match(int number_of_execution
        if (new_packet_to_send != NULL) {
                pg_strlcpy(new_packet_to_send, packet_to_send, strlen(packet_to_send));
                strncat(new_packet_to_send, packet_to_send, sizeof(new_packet_to_send) - strlen(new_packet_to_send) - 1);
+                       free(packet_to_send);
                        packet_to_send = strdup(new_packet_to_send);
                        free(new_packet_to_send);
        }
@@ -349,6 +350,7 @@ static void __test_privacy_guard_client_dlp_string_match(int number_of_execution
                if(show_clock) interval[count] = (tp_after.tv_sec - tp_before.tv_sec) * 1000000000 + tp_after.tv_nsec - tp_before.tv_nsec;
        }
 
+       free(packet_to_send);
        __finish_test();
 }