summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7c2336d)
raw | patch | inline | side by side (parent: 7c2336d)
author | Florian Forster <octo@collectd.org> | |
Wed, 15 Nov 2017 20:38:32 +0000 (21:38 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 17 Nov 2017 12:21:55 +0000 (13:21 +0100) |
Allocate "entry" later so that the error handling blocks don't leak it.
CID: 179244
CID: 179244
src/snmp_agent.c | patch | blob | history |
diff --git a/src/snmp_agent.c b/src/snmp_agent.c
index 497d157c07a0193479daeda36002d7bdf2aee4ec..948107b5b62eee002c462886d5238368cd8c7adc 100644 (file)
--- a/src/snmp_agent.c
+++ b/src/snmp_agent.c
}
}
- llentry_t *entry = llentry_create(td->name, td);
- if (entry == NULL) {
- snmp_agent_free_table(&td);
- return -ENOMEM;
- }
-
td->instance_index =
c_avl_create((int (*)(const void *, const void *))strcmp);
if (td->instance_index == NULL) {
return -ENOMEM;
}
+ llentry_t *entry = llentry_create(td->name, td);
+ if (entry == NULL) {
+ snmp_agent_free_table(&td);
+ return -ENOMEM;
+ }
llist_append(g_agent->tables, entry);
return 0;