provisioning: Close database in tests 99/22099/13
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 24 Aug 2017 10:11:29 +0000 (12:11 +0200)
committerRandeep Singh <randeep.s@samsung.com>
Mon, 16 Oct 2017 12:11:25 +0000 (12:11 +0000)
Bug: https://jira.iotivity.org/browse/IOT-2599
Change-Id: Ie49d06287bc6fb3b0ac75c0271af3861c729d436
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/22075
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Mats Wichmann <mats@linux.com>
(cherry picked from commit 043d580965d448da6d15710cf6b0cc7b4c18e4f8)

resource/csdk/security/provisioning/src/provisioningdatabasemanager.c

index 608b0f3..c6f14c6 100644 (file)
@@ -833,7 +833,11 @@ OCStackResult PDMClose()
 
     CHECK_PDM_INIT(TAG);
     int res = 0;
-    res = sqlite3_close(g_db);
+    if (g_db)
+    {
+        res = sqlite3_close(g_db);
+        g_db = NULL;
+    }
     PDM_VERIFY_SQLITE_OK(TAG, res, ERROR, OC_STACK_ERROR);
     OIC_LOG_V(DEBUG, TAG, "OUT %s", __func__);
     return OC_STACK_OK;