Merge "Fixed minor issues" into tizen
authorjusung son <jusung07.son@samsung.com>
Fri, 18 Aug 2017 00:24:18 +0000 (00:24 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 18 Aug 2017 00:24:18 +0000 (00:24 +0000)
src/data_control_internal.c
src/data_control_provider.c

index 8d0d31f..187f67a 100755 (executable)
@@ -623,7 +623,7 @@ static int __recv_sql_select_process(bundle *kb, int fd,
                        }
 
                        if (size > 0 && size < MAX_REQUEST_ARGUMENT_SIZE) {
-                               value = (void *)malloc(sizeof(void) * size);
+                               value = (void *)malloc(sizeof(char) * size);
                                if (value == NULL) {
                                        _LOGE("Out of mememory");
                                        retval = DATA_CONTROL_ERROR_IO_ERROR;
@@ -637,7 +637,7 @@ static int __recv_sql_select_process(bundle *kb, int fd,
                                        goto out;
                                }
                                _LOGE("value : %s", (char *)value);
-                               if (write(result_fd, value, sizeof(void) * size) == -1) {
+                               if (write(result_fd, value, sizeof(char) * size) == -1) {
                                        _LOGE("Writing a value to a file descriptor is failed. errno = %d", errno);
                                        retval = DATA_CONTROL_ERROR_IO_ERROR;
                                        goto out;
index ee86306..5013d2b 100755 (executable)
@@ -1002,7 +1002,7 @@ static int __send_select_result(int fd, bundle *b, void *data)
                                        return DATA_CONTROL_ERROR_IO_ERROR;
 
                                buf_len = sizeof(int) * 2 + size;
-                               buf = calloc(buf_len, sizeof(void));
+                               buf = calloc(buf_len, sizeof(char));
                                if (buf == NULL) {
                                        _LOGE("calloc failed");
                                        return DATA_CONTROL_ERROR_OUT_OF_MEMORY;
@@ -2282,7 +2282,6 @@ EXPORT_API char *data_control_provider_create_insert_statement(
                set_last_result(DATA_CONTROL_ERROR_OUT_OF_MEMORY);
                return NULL;
        }
-       memset(sql, 0, sql_len);
 
        snprintf(sql, sql_len, "INSERT INTO %s (", data_id);
        free(data_id);
@@ -2342,7 +2341,6 @@ EXPORT_API char *data_control_provider_create_delete_statement(
                set_last_result(DATA_CONTROL_ERROR_OUT_OF_MEMORY);
                return NULL;
        }
-       memset(sql, 0, sql_len);
 
        snprintf(sql, sql_len, "DELETE FROM %s", data_id);
        if (where) {
@@ -2413,7 +2411,6 @@ EXPORT_API char *data_control_provider_create_update_statement(
                set_last_result(DATA_CONTROL_ERROR_OUT_OF_MEMORY);
                return NULL;
        }
-       memset(sql, 0, sql_len);
 
        snprintf(sql, sql_len, "UPDATE %s SET ", data_id);
        free(data_id);
@@ -2489,7 +2486,6 @@ EXPORT_API char *data_control_provider_create_select_statement(
                set_last_result(DATA_CONTROL_ERROR_OUT_OF_MEMORY);
                return NULL;
        }
-       memset(sql, 0, sql_len);
 
        strncpy(sql, "SELECT ", sql_len);
        if (!column_list) {