|
|
9a6c41 |
729738 - net-snmp dumps core in netsnmp_oid_find_prefix
|
|
|
9a6c41 |
|
|
|
9a6c41 |
commit f9304c83f76202db0e684269ca1af32e43cd9db4
|
|
|
9a6c41 |
Author: Jan Safranek <jsafranek@users.sourceforge.net>
|
|
|
9a6c41 |
Date: Tue Feb 7 14:53:44 2012 +0100
|
|
|
9a6c41 |
|
|
|
9a6c41 |
CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent disconnect in the middle of processing of a request.
|
|
|
9a6c41 |
|
|
|
9a6c41 |
I fixed also the memory leak reported in the tracker comments.
|
|
|
9a6c41 |
|
|
|
9a6c41 |
diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
|
|
|
9a6c41 |
index c42a42a..baeebaf 100644
|
|
|
9a6c41 |
--- a/agent/mibgroup/agentx/master.c
|
|
|
9a6c41 |
+++ b/agent/mibgroup/agentx/master.c
|
|
|
9a6c41 |
@@ -219,6 +219,9 @@ agentx_got_response(int operation,
|
|
|
9a6c41 |
if (!cache) {
|
|
|
9a6c41 |
DEBUGMSGTL(("agentx/master", "response too late on session %8p\n",
|
|
|
9a6c41 |
session));
|
|
|
9a6c41 |
+ /* response is too late, free the cache */
|
|
|
9a6c41 |
+ if (magic)
|
|
|
9a6c41 |
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
|
|
|
9a6c41 |
return 0;
|
|
|
9a6c41 |
}
|
|
|
9a6c41 |
requests = cache->requests;
|
|
|
9a6c41 |
@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler,
|
|
|
9a6c41 |
result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
|
|
|
9a6c41 |
if (result == 0) {
|
|
|
9a6c41 |
snmp_free_pdu(pdu);
|
|
|
9a6c41 |
+ if (cb_data)
|
|
|
9a6c41 |
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data);
|
|
|
9a6c41 |
}
|
|
|
9a6c41 |
|
|
|
9a6c41 |
return SNMP_ERR_NOERROR;
|
|
|
9a6c41 |
diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
|
|
|
9a6c41 |
index f16f392..b84b85e 100644
|
|
|
9a6c41 |
--- a/agent/mibgroup/agentx/master_admin.c
|
|
|
9a6c41 |
+++ b/agent/mibgroup/agentx/master_admin.c
|
|
|
9a6c41 |
@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid)
|
|
|
9a6c41 |
* requests, so that the delegated request will be completed and
|
|
|
9a6c41 |
* further requests can be processed
|
|
|
9a6c41 |
*/
|
|
|
9a6c41 |
- netsnmp_remove_delegated_requests_for_session(session);
|
|
|
9a6c41 |
+ while (netsnmp_remove_delegated_requests_for_session(session)) {
|
|
|
9a6c41 |
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n"));
|
|
|
9a6c41 |
+ }
|
|
|
9a6c41 |
+
|
|
|
9a6c41 |
if (session->subsession != NULL) {
|
|
|
9a6c41 |
netsnmp_session *subsession = session->subsession;
|
|
|
9a6c41 |
for(; subsession; subsession = subsession->next) {
|
|
|
9a6c41 |
- netsnmp_remove_delegated_requests_for_session(subsession);
|
|
|
9a6c41 |
+ while (netsnmp_remove_delegated_requests_for_session(subsession)) {
|
|
|
9a6c41 |
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n"));
|
|
|
9a6c41 |
+ }
|
|
|
9a6c41 |
}
|
|
|
9a6c41 |
}
|
|
|
9a6c41 |
|