diff --git a/src/modules/snmpstats/snmpSIPStatusCodesTable.c b/src/modules/snmpstats/snmpSIPStatusCodesTable.c index 0bd5ba11feb..784d6b7cf55 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 +}