<p></p>
<p><b>@miconda</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/kamailio/kamailio/pull/2891#discussion_r737371988">src/modules/acc/acc_mod.c</a>:</p>
<pre style='color:#555'>> +
+       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");
+       }
</pre>
<p>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.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2891#pullrequestreview-790507855">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZK6WHEKWMY2MJLEXI3UI7WLJANCNFSM5GNRVCXA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABO7UZLHDBSRD3HLKVHY3ZLUI7WLJA5CNFSM5GNRVCXKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOF4PDCTY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2891#pullrequestreview-790507855",
"url": "https://github.com/kamailio/kamailio/pull/2891#pullrequestreview-790507855",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>