Skip to content

Commit

Permalink
acc: init to 0 the arrays allocated for accounting
Browse files Browse the repository at this point in the history
(cherry picked from commit 721ec27)
  • Loading branch information
miconda committed Jan 6, 2023
1 parent 6d19964 commit f625473
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/modules/acc/acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,32 +633,32 @@ void acc_api_set_arrays(acc_info_t *inf)
}

int acc_arrays_alloc(void) {
if ((val_arr = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(str))) == NULL) {
if ((val_arr = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(str))) == NULL) {
LM_ERR("failed to alloc val_arr\n");
return -1;
}

if ((int_arr = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(int))) == NULL) {
if ((int_arr = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(int))) == NULL) {
LM_ERR("failed to alloc int_arr\n");
return -1;
}

if ((type_arr = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(char))) == NULL) {
if ((type_arr = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(char))) == NULL) {
LM_ERR("failed to alloc type_arr\n");
return -1;
}

if ((log_attrs = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(str))) == NULL) {
if ((log_attrs = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(str))) == NULL) {
LM_ERR("failed to alloc log_attrs\n");
return -1;
}

if ((db_keys = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_key_t))) == NULL) {
if ((db_keys = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_key_t))) == NULL) {
LM_ERR("failed to alloc db_keys\n");
return -1;
}

if ((db_vals = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_val_t))) == NULL) {
if ((db_vals = pkg_mallocxz((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_val_t))) == NULL) {
LM_ERR("failed to alloc db_vals\n");
return -1;
}
Expand Down

0 comments on commit f625473

Please sign in to comment.