Skip to content

Commit

Permalink
snmpstats: free table_info in case of error for SIPStatusCodesTable
Browse files Browse the repository at this point in the history
(cherry picked from commit 172cfd3)
  • Loading branch information
miconda committed Jan 19, 2018
1 parent 087b629 commit 8555554
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/modules/snmpstats/snmpSIPStatusCodesTable.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -786,4 +791,4 @@ kamailioSIPStatusCodesTable_get_by_idx(netsnmp_index *hdr)
{
return (const kamailioSIPStatusCodesTable_context *)CONTAINER_FIND(
cb.container, hdr);
}
}

0 comments on commit 8555554

Please sign in to comment.