Fix dp_client_slot_free() api 05/71805/1 accepted/tizen/common/20160527.154038 submit/tizen_common/20160527.071314 submit/tizen_mobile/20160527.071239 submit/tizen_tv/20160527.071251 submit/tizen_wearable/20160527.071304
authormin7.choi <min7.choi@samsung.com>
Fri, 27 May 2016 07:03:04 +0000 (16:03 +0900)
committermin7.choi <min7.choi@samsung.com>
Fri, 27 May 2016 07:03:10 +0000 (16:03 +0900)
   - Kona : CH160523-00058

Change-Id: I6820c819b753727e017be1306f7688317a10c825
Signed-off-by: min7.choi <min7.choi@samsung.com>
packaging/download-provider.spec
provider/download-provider-client-manager.c
provider/download-provider-client.c

index 4150bc2..5273b62 100755 (executable)
@@ -1,7 +1,7 @@
 %define _ux_define tizen2.3
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.1.52
+Version:    2.1.53
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 605f831..4cb325d 100755 (executable)
@@ -392,11 +392,15 @@ static int __dp_client_new(int clientfd, dp_client_slots_fmt *clients,
        int errorcode = DP_ERROR_NONE;
        int i = 0;
        int pkg_len = 0;
-       char pkgname[256] = { 0, };
+       char *pkgname = NULL;
+
+       char buffer[256] = { 0, };
 
        // getting the package name via pid
-       if (aul_app_get_appid_bypid_for_uid(credential.pid, pkgname, 256, credential.uid) != AUL_R_OK)
+       if (aul_app_get_appid_bypid_for_uid(credential.pid, buffer, sizeof(buffer), credential.uid) != AUL_R_OK)
                TRACE_ERROR("[CRITICAL] aul_app_get_appid_bypid_for_uid");
+
+       pkgname = strdup(buffer);
 /*
        //// TEST CODE ... to allow sample client ( no package name ).
        if (pkgname == NULL) {
@@ -417,6 +421,7 @@ static int __dp_client_new(int clientfd, dp_client_slots_fmt *clients,
 */
        if ((pkg_len = strlen(pkgname)) <= 0) {
                TRACE_ERROR("[CRITICAL] pkgname:%s", pkgname);
+               free(pkgname);
                return DP_ERROR_INVALID_PARAMETER;
        }
 
@@ -524,7 +529,7 @@ static int __dp_client_new(int clientfd, dp_client_slots_fmt *clients,
                                        CLIENT_MUTEX_UNLOCK(&clients[i].mutex);
                                        if (errorcode != DP_ERROR_NONE)
                                                dp_mutex_destroy(&clients[i].mutex);
-//                                     free(pkgname);
+                                       free(pkgname);
                                        return errorcode;
                                }
                        }
@@ -561,7 +566,7 @@ static int __dp_client_new(int clientfd, dp_client_slots_fmt *clients,
 
        TRACE_SECURE_INFO("busy client[%s] pid:%d sock:%d", pkgname,
                credential.pid, clientfd);
-
+       free(pkgname);
        return DP_ERROR_TOO_MANY_DOWNLOADS;
 }
 
index 4d93f59..4a6c1cd 100755 (executable)
@@ -2005,11 +2005,11 @@ void *dp_client_request_thread(void *arg)
 
                        CLIENT_MUTEX_LOCK(&slot->mutex);
 
-                       errorcode = DP_ERROR_NONE;
-
                        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
                        client->access_time = (int)time(NULL);
 
+                       errorcode = DP_ERROR_NONE;
+
                        // read ipc_fmt first. below func will deal followed packets
                        dp_ipc_fmt *ipc_info = dp_ipc_get_fmt(client_sock);
                        if (ipc_info == NULL) {