@miconda commented on this pull request.
+ if ((type_arr = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(char))) == NULL) { + LM_ERR("failed to alloc type_arr\n"); + } + + if ((log_attrs = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(str))) == NULL) { + LM_ERR("failed to alloc log_attrs\n"); + } + + if ((db_keys = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_key_t))) == NULL) { + LM_ERR("failed to alloc db_keys\n"); + } + + if ((db_vals = pkg_malloc((ACC_CORE_LEN + acc_extra_size + MAX_ACC_LEG + 3) * sizeof(db_val_t))) == NULL) { + LM_ERR("failed to alloc db_vals\n"); + }
I think it is better to fail completely and don't start if malloc fails, the module will crash or not work, so makes no sense to continue. Return -1 in such cases.