Set pointer to NULL after free

This commit is contained in:
Mico Micic 2024-07-29 10:01:06 +02:00 committed by Olof Hagsand
parent 87921cb740
commit a2fe24937b

View file

@ -179,10 +179,14 @@ add_snmp_var_bindings(netsnmp_variable_list **var_list,
clixon_debug(CLIXON_DBG_SNMP, "type %s not supported in snmp trap", yang_key2str(yang_keyword_get(ychild))); clixon_debug(CLIXON_DBG_SNMP, "type %s not supported in snmp trap", yang_key2str(yang_keyword_get(ychild)));
break; break;
} }
if (xmlstr) if (xmlstr) {
free(xmlstr); free(xmlstr);
if (snmpval) xmlstr = NULL;
}
if (snmpval) {
free(snmpval); free(snmpval);
snmpval = NULL;
}
} else { } else {
clixon_debug(CLIXON_DBG_SNMP, "no yang def found for %s", node_name); clixon_debug(CLIXON_DBG_SNMP, "no yang def found for %s", node_name);
} }