summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuwentan <[email protected]>2023-09-21 09:30:07 +0800
committerliuwentan <[email protected]>2023-09-21 09:30:07 +0800
commit2a9ba6c08fc8620dd98d64ded7ab14e3fc2b610d (patch)
tree9ab7199cfe7254d71a6def08a82db24541176fb6
parent4f5f5a1c843b92f5dd1c825be5faa788abfb04dd (diff)
[PATCH]fix maat_state_free_bytes statistics error
-rw-r--r--deps/uthash/utarray.h1
-rw-r--r--src/maat_compile.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/deps/uthash/utarray.h b/deps/uthash/utarray.h
index 6b62018..5900905 100644
--- a/deps/uthash/utarray.h
+++ b/deps/uthash/utarray.h
@@ -125,6 +125,7 @@ typedef struct {
} while(0)
#define utarray_len(a) ((a)->i)
+#define utarray_size(a) ((a)->n)
#define utarray_eltptr(a,j) (((j) < (a)->i) ? _utarray_eltptr(a,j) : NULL)
#define _utarray_eltptr(a,j) ((void*)((a)->d + ((a)->icd.sz * (j))))
diff --git a/src/maat_compile.c b/src/maat_compile.c
index f461bdc..bc50b27 100644
--- a/src/maat_compile.c
+++ b/src/maat_compile.c
@@ -1381,33 +1381,33 @@ void maat_compile_state_free(struct maat_compile_state *compile_state,
long long free_bytes = 0;
if (compile_state->internal_hit_paths != NULL) {
- free_bytes += utarray_len(compile_state->internal_hit_paths) *
+ free_bytes += utarray_size(compile_state->internal_hit_paths) *
sizeof(struct maat_internal_hit_path);
utarray_free(compile_state->internal_hit_paths);
compile_state->internal_hit_paths = NULL;
}
if (compile_state->internal_inc_hit_paths != NULL) {
- free_bytes += utarray_len(compile_state->internal_inc_hit_paths) *
+ free_bytes += utarray_size(compile_state->internal_inc_hit_paths) *
sizeof(struct maat_internal_hit_path);
utarray_free(compile_state->internal_inc_hit_paths);
compile_state->internal_inc_hit_paths = NULL;
}
if (compile_state->all_hit_clauses != NULL) {
- free_bytes += utarray_len(compile_state->all_hit_clauses) * sizeof(long long);
+ free_bytes += utarray_size(compile_state->all_hit_clauses) * sizeof(long long);
utarray_free(compile_state->all_hit_clauses);
compile_state->all_hit_clauses = NULL;
}
if (compile_state->this_scan_hit_clauses != NULL) {
- free_bytes += utarray_len(compile_state->this_scan_hit_clauses) * sizeof(long long);
+ free_bytes += utarray_size(compile_state->this_scan_hit_clauses) * sizeof(long long);
utarray_free(compile_state->this_scan_hit_clauses);
compile_state->this_scan_hit_clauses = NULL;
}
if (compile_state->indirect_hit_groups != NULL) {
- free_bytes += utarray_len(compile_state->indirect_hit_groups) * sizeof(struct maat_hit_group);
+ free_bytes += utarray_size(compile_state->indirect_hit_groups) * sizeof(struct maat_hit_group);
utarray_free(compile_state->indirect_hit_groups);
compile_state->indirect_hit_groups = NULL;
}