[sr-dev] [kamailio/kamailio] acc: increase extra and cdr variables (PR #2891)

Daniel-Constantin Mierla notifications at github.com
Wed Oct 27 13:31:48 CEST 2021


@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.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2891#pullrequestreview-790507855
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20211027/da04b824/attachment.htm>


More information about the sr-dev mailing list