Sync with tizen_2.4, latest 42/69642/1 accepted/tizen/mobile/20160516.091818 accepted/tizen/tv/20160516.091727 accepted/tizen/wearable/20160516.091821 submit/tizen_mobile/20160516.083439 submit/tizen_tv/20160516.083444 submit/tizen_wearable/20160516.083449
authormin7.choi <min7.choi@samsung.com>
Mon, 16 May 2016 08:17:16 +0000 (17:17 +0900)
committermin7.choi <min7.choi@samsung.com>
Mon, 16 May 2016 08:17:22 +0000 (17:17 +0900)
- Fix memory leak bug
- Fix repeated deallocate bug
- Fix Security issue
- Fix Large file download issue

Change-Id: I80e5df5a116f939a2ede51d2f5327bd69ea2f295
Signed-off-by: min7.choi <min7.choi@samsung.com>
agent/download-agent-file.c
agent/download-agent-http-msg-handler.c
agent/include/download-agent-file.h
packaging/download-provider.spec
provider/download-provider-client.c

index 05866ac..df1e1cd 100755 (executable)
@@ -177,8 +177,8 @@ da_ret_t __file_write_buf_flush_buf(file_info_t *file_info)
 {
        da_ret_t ret = DA_RESULT_OK;
        char *buffer = DA_NULL;
-       int buffer_size = 0;
-       int write_success_len = 0;
+       size_t buffer_size = 0;
+       size_t write_success_len = 0;
        void *fd = DA_NULL;
 
        //      DA_LOGV("");
@@ -224,7 +224,7 @@ da_ret_t __file_write_buf_copy_to_buf(file_info_t *file_info, char *body,
 {
        da_ret_t ret = DA_RESULT_OK;
        char *buffer = DA_NULL;
-       int buffer_size = 0;
+       size_t buffer_size = 0;
 
        DA_LOGV("");
 
@@ -571,7 +571,7 @@ da_ret_t start_file_append(file_info_t *file_info)
 da_ret_t file_write_ongoing(file_info_t *file_info, char *body, int body_len)
 {
        da_ret_t ret = DA_RESULT_OK;
-       int buffer_size = 0;
+       size_t buffer_size = 0;
        char *buffer = DA_NULL;
 
        DA_LOGV("");
index 231a61d..fc48c28 100755 (executable)
@@ -95,7 +95,7 @@ void http_msg_request_destroy(http_msg_request_t **http_msg_request)
                        temp_http_msg_request->http_body = NULL;
                }
                __http_header_destroy_all_field(&(temp_http_msg_request->head));
-               free(temp_http_msg_request);
+               free(*http_msg_request);
                *http_msg_request = NULL;
        }
 }
@@ -178,7 +178,7 @@ void http_msg_response_destroy(http_msg_response_t **http_msg_response)
        DA_LOGV("");
        if (temp_http_msg_response) {
                __http_header_destroy_all_field(&(temp_http_msg_response->head));
-               free(temp_http_msg_response);
+               free(*http_msg_response);
                *http_msg_response = DA_NULL;
        }
 }
index 2788fdd..6f960ce 100755 (executable)
@@ -24,7 +24,7 @@
 #include "download-agent-type.h"
 #include "download-agent-dl-info.h"
 
-#define DA_FILE_BUF_SIZE (1024*32) //bytes
+#define DA_FILE_BUF_SIZE (1024*32*2) //bytes
 
 da_ret_t check_drm_convert(file_info_t *file_info);
 da_bool_t is_file_exist(const char *file_path);
index ea47df0..3b0dc49 100755 (executable)
@@ -1,7 +1,7 @@
 %define _ux_define tizen2.3
 Name:       download-provider
 Summary:    Download the contents in background
-Version:    2.1.40
+Version:    2.1.50
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
@@ -96,7 +96,7 @@ Description: Download the contents in background (development files)
 %endif
 
 %define cmake \
-       CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -fvisibility=hidden"; export CFLAGS \
+       CFLAGS="${CFLAGS:-%optflags} -fPIC -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fvisibility=hidden"; export CFLAGS \
        FFLAGS="${FFLAGS:-%optflags} -fPIC -fvisibility=hidden"; export FFLAGS \
        LDFLAGS+=" -Wl,--as-needed -Wl,--hash-style=both"; export LDFLAGS \
        %__cmake \\\
index 3b210c8..4d93f59 100755 (executable)
@@ -962,12 +962,11 @@ static int __dp_request_get_info(dp_client_fmt *client, dp_ipc_fmt *ipc_info, dp
                                                break;
                                        }
                                }
-                               if(ids) {
-                                       free(ids);
-                               }
+                       }
+                       if(ids) {
+                           free(ids);
                        }
                }
-
                break;
        }
        case DP_PROP_HTTP_HEADER: