From 95f8fc22eb066f7f091e40104f42d60625b34eb7 Mon Sep 17 00:00:00 2001 From: "min7.choi" Date: Fri, 27 May 2016 16:03:04 +0900 Subject: [PATCH] Fix dp_client_slot_free() api - Kona : CH160523-00058 Change-Id: I6820c819b753727e017be1306f7688317a10c825 Signed-off-by: min7.choi --- packaging/download-provider.spec | 2 +- provider/download-provider-client-manager.c | 13 +++++++++---- provider/download-provider-client.c | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packaging/download-provider.spec b/packaging/download-provider.spec index 4150bc2..5273b62 100755 --- a/packaging/download-provider.spec +++ b/packaging/download-provider.spec @@ -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 diff --git a/provider/download-provider-client-manager.c b/provider/download-provider-client-manager.c index 605f831..4cb325d 100755 --- a/provider/download-provider-client-manager.c +++ b/provider/download-provider-client-manager.c @@ -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; } diff --git a/provider/download-provider-client.c b/provider/download-provider-client.c index 4d93f59..4a6c1cd 100755 --- a/provider/download-provider-client.c +++ b/provider/download-provider-client.c @@ -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) { -- 2.7.4