diff options
| author | root <[email protected]> | 2024-10-25 06:27:34 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-10-25 06:27:34 +0000 |
| commit | 12241e65805b3e202ec6e1c8a816971f6bfecb91 (patch) | |
| tree | a8f0b89e28e9de74f2ff10a8f4619d20c146dc30 /test/test_utils.cpp | |
| parent | b66307704547add235ba590dc0341c641eae768a (diff) | |
fix memory leak in test casev5.0.0
Diffstat (limited to 'test/test_utils.cpp')
| -rw-r--r-- | test/test_utils.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test_utils.cpp b/test/test_utils.cpp index 48739da..946935c 100644 --- a/test/test_utils.cpp +++ b/test/test_utils.cpp @@ -199,12 +199,11 @@ int object_group_table_set_line(struct maat *maat_inst, const char *table_name, const char exc_object_uuid_strs[][UUID_STR_LEN], int exc_object_num, int expire_after) { cJSON *json_root = cJSON_CreateObject(); - cJSON *inc_object_uuid_str_array = cJSON_CreateArray(); - cJSON *exc_object_uuid_str_array = cJSON_CreateArray(); cJSON_AddStringToObject(json_root, "object_uuid", object_uuid_str); if (inc_object_num > 0) { + cJSON *inc_object_uuid_str_array = cJSON_CreateArray(); for (int i = 0; i < inc_object_num; i++) { cJSON_AddItemToArray(inc_object_uuid_str_array, cJSON_CreateString(inc_object_uuid_strs[i])); } @@ -212,6 +211,7 @@ int object_group_table_set_line(struct maat *maat_inst, const char *table_name, } if (exc_object_num > 0) { + cJSON *exc_object_uuid_str_array = cJSON_CreateArray(); for (int i = 0; i < exc_object_num; i++) { cJSON_AddItemToArray(exc_object_uuid_str_array, cJSON_CreateString(exc_object_uuid_strs[i])); } |
