[Feature][T106BUG-559]fix memory leak of qser_data_call_init

Only Configure: No
Affected branch: master
Affected module: data
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Ibfbdb3e93c8d94dc73cefa622dc1c0c7b3f2db2a
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 94af56b..93494ca 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -632,6 +632,7 @@
     if (rc == SQLITE_OK) 
     {
         LYINFLOG("check init success!");
+        sqlite3_close_v2(apnDb_l);
         return APN_DB_READED;
     } 
     else 
@@ -787,6 +788,7 @@
     {
         LYERRLOG("SQL error: %s\n", zErrMsg);
         sqlite3_free(zErrMsg);
+        sqlite3_close(apnDb);
         return -1;
     }
     else
@@ -1223,15 +1225,21 @@
 
 int qser_cb_pthread_create()
 {
+    pthread_attr_t attr;
     int ret;
     s_qser_data_cb_thread_status = 1;
-    ret = pthread_create(&s_cb_tid,NULL,thread_wait_cb_status,NULL);
+    
+    pthread_attr_init(&attr);
+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+    ret = pthread_create(&s_cb_tid,&attr,thread_wait_cb_status,NULL);
     if (ret < 0)
     {
         LYERRLOG("pthread create fail");
         s_qser_data_cb_thread_status = 0;
         return RESULT_ERROR;
     }
+    pthread_attr_destroy(&attr);
     return RESULT_OK;
 }