summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9bdf6cb)
raw | patch | inline | side by side (parent: 9bdf6cb)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 12 Jul 2017 14:26:13 +0000 (21:26 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Thu, 13 Jul 2017 15:21:24 +0000 (22:21 +0700) |
Also appropriate `llist_destroy()` calls added.
src/snmp_agent.c | patch | blob | history |
diff --git a/src/snmp_agent.c b/src/snmp_agent.c
index 1ea5cc97233c054ee2706cc966b897345caaeddc..fe1ecd56ac246b0b3cd4ad3198d420469426cd9f 100644 (file)
--- a/src/snmp_agent.c
+++ b/src/snmp_agent.c
g_agent->tables = llist_create();
g_agent->scalars = llist_create();
+ if (g_agent->tables == NULL || g_agent->scalars == NULL) {
+ ERROR(PLUGIN_NAME ": llist_create() failed");
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
+ return -ENOMEM;
+ }
+
int err;
/* make us a agentx client. */
err = netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
1);
if (err != 0) {
ERROR(PLUGIN_NAME ": Failed to set agent role (%d)", err);
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
return -1;
}
err = init_agent(PLUGIN_NAME);
if (err != 0) {
ERROR(PLUGIN_NAME ": Failed to initialize the agent library (%d)", err);
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
return -1;
}