Module: kamailio
Branch: master
Commit: 172cfd3494db462593da2d04feb6528f9ad3a84c
URL:
https://github.com/kamailio/kamailio/commit/172cfd3494db462593da2d04feb6528…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-27T09:08:08+01:00
snmpstats: free table_info in case of error for SIPStatusCodesTable
---
Modified: src/modules/snmpstats/snmpSIPStatusCodesTable.c
---
Diff:
https://github.com/kamailio/kamailio/commit/172cfd3494db462593da2d04feb6528…
Patch:
https://github.com/kamailio/kamailio/commit/172cfd3494db462593da2d04feb6528…
---
diff --git a/src/modules/snmpstats/snmpSIPStatusCodesTable.c
b/src/modules/snmpstats/snmpSIPStatusCodesTable.c
index 0bd5ba11fe..784d6b7cf5 100644
--- a/src/modules/snmpstats/snmpSIPStatusCodesTable.c
+++ b/src/modules/snmpstats/snmpSIPStatusCodesTable.c
@@ -625,13 +625,18 @@ void initialize_table_kamailioSIPStatusCodesTable(void)
/** create the table structure itself */
table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if(!table_info) {
+ snmp_log(LOG_ERR, "failed to allocate table_info\n");
+ return;
+ }
my_handler = netsnmp_create_handler_registration(
"kamailioSIPStatusCodesTable", netsnmp_table_array_helper_handler,
kamailioSIPStatusCodesTable_oid,
kamailioSIPStatusCodesTable_oid_len, HANDLER_CAN_RWRITE);
- if(!my_handler || !table_info) {
+ if(!my_handler) {
+ SNMP_FREE(table_info);
snmp_log(LOG_ERR, "malloc failed in initialize_table_kamailioSIP"
"StatusCodesTable_handler\n");
return; /** mallocs failed */
@@ -786,4 +791,4 @@ kamailioSIPStatusCodesTable_get_by_idx(netsnmp_index *hdr)
{
return (const kamailioSIPStatusCodesTable_context *)CONTAINER_FIND(
cb.container, hdr);
-}
\ No newline at end of file
+}