svace fixes
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / src / provisioningdatabasemanager.c
index c774b76..93ce7de 100644 (file)
@@ -323,7 +323,7 @@ OCStackResult OTMStart(const OicUuid_t *uuid, const OicUuid_t *owner)
     sqlite3_finalize(stmt);
 
     OIC_LOG_V(DEBUG, TAG, "OUT %s", __func__);
-    return OC_STACK_OK;
+    return ret;
 }
 
 OCStackResult OTMSetState(const OicUuid_t *uuid, int state)
@@ -393,12 +393,11 @@ OCStackResult OTMGetState(const OicUuid_t *uuid, int *state)
     res = sqlite3_bind_text(stmt, 1, uuidStr, strlen(uuidStr), SQLITE_TRANSIENT);
     PDM_VERIFY_SQLITE_OK(TAG, res, NULL, ERROR, OC_STACK_ERROR);
 
-    while (SQLITE_ROW == sqlite3_step(stmt))
+    if (SQLITE_ROW == sqlite3_step(stmt))
     {
         *state = sqlite3_column_int(stmt, 1);
         OIC_LOG_V(DEBUG, TAG, "%s state is %d", uuidStr, *state);
         ret = OC_STACK_OK;
-        break;
     }
 
     OICFree(uuidStr);
@@ -474,7 +473,7 @@ static OCStackResult getIdForUUID(const OicUuid_t *UUID , int *id)
     res = sqlite3_prepare_v2(g_db, sqlStat, (int)sizeof(sqlStat), &stmt, 0);
     PDM_VERIFY_SQLITE_OK(TAG, res, stmt, ERROR, OC_STACK_ERROR);
 
-    while (SQLITE_ROW == sqlite3_step(stmt))
+    if (SQLITE_ROW == sqlite3_step(stmt))
     {
         int tempId = sqlite3_column_int(stmt, PDM_FIRST_INDEX);
         OIC_LOG_V(DEBUG, TAG, "ID is %d", tempId);
@@ -841,7 +840,7 @@ static OCStackResult getUUIDforId(int id, OicUuid_t *uid, bool *result)
     res = sqlite3_bind_int(stmt, PDM_BIND_INDEX_FIRST, id);
     PDM_VERIFY_SQLITE_OK(TAG, res, stmt, ERROR, OC_STACK_ERROR);
 
-    while (SQLITE_ROW == sqlite3_step(stmt))
+    if (SQLITE_ROW == sqlite3_step(stmt))
     {
         const void *ptr = sqlite3_column_blob(stmt, PDM_FIRST_INDEX);
         memcpy(uid, ptr, sizeof(OicUuid_t));