Fix memory leak 99/122599/1
authorInkyun Kil <inkyun.kil@samsung.com>
Mon, 3 Apr 2017 04:58:24 +0000 (13:58 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Mon, 3 Apr 2017 04:58:24 +0000 (13:58 +0900)
Change-Id: Ia8a11504445b09e91b65632778f2e7eaf7c0a9a6
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/data-control-map.c
src/data-control-sql.c

index b5239cf..ccabaf0 100755 (executable)
@@ -284,8 +284,12 @@ static int __map_handle_cb(int fd, bundle *b, int request_type, int request_id,
                LOGI("BULK ADD RESPONSE");
                if (provider_result) {
                        if (_recv_bulk_process(fd, &bulk_results)
-                                               != DATACONTROL_ERROR_NONE)
-                                       return DATACONTROL_ERROR_IO_ERROR;
+                                               != DATACONTROL_ERROR_NONE) {
+                               if (bulk_results)
+                                       datacontrol_bulk_result_data_destroy(bulk_results);
+
+                               return DATACONTROL_ERROR_IO_ERROR;
+                       }
                }
                break;
        case DATACONTROL_TYPE_MAP_GET:
index cce6e53..406417a 100755 (executable)
@@ -234,8 +234,12 @@ static int __sql_handle_cb(bundle *b, void *data, int fd, int request_id)
                        LOGI("BULK INSERT RESPONSE");
                        if (provider_result) {
                                if (__recv_sql_bulk_insert_process(fd, &bulk_results)
-                                               != DATACONTROL_ERROR_NONE)
+                                               != DATACONTROL_ERROR_NONE) {
+                                       if (bulk_results)
+                                               datacontrol_bulk_result_data_destroy(bulk_results);
+
                                        return DATACONTROL_ERROR_IO_ERROR;
+                               }
                        }
                        break;
                case DATACONTROL_TYPE_SQL_SELECT: