snmp_discover_engine: fix up req/resp (PDU object) handling a bit
- Call snmp_pdu_free on req and resp when done with the objects - Call snmp_pdu_free on req before calling snmp_pdu_create on it again MFC after: 1 week
This commit is contained in:
parent
86b3c16952
commit
1cc49661ec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310988
@ -1793,12 +1793,14 @@ snmp_discover_engine(char *passwd)
|
||||
return (0);
|
||||
}
|
||||
|
||||
snmp_pdu_free(&req);
|
||||
|
||||
snmp_pdu_create(&req, SNMP_PDU_GET);
|
||||
req.engine.engine_boots = 0;
|
||||
req.engine.engine_time = 0;
|
||||
|
||||
if (snmp_dialog(&req, &resp) == -1)
|
||||
return (-1);
|
||||
return (-1);
|
||||
|
||||
if (resp.version != req.version) {
|
||||
seterr(&snmp_client, "wrong version");
|
||||
@ -1813,6 +1815,9 @@ snmp_discover_engine(char *passwd)
|
||||
snmp_client.engine.engine_boots = resp.engine.engine_boots;
|
||||
snmp_client.engine.engine_time = resp.engine.engine_time;
|
||||
|
||||
snmp_pdu_free(&req);
|
||||
snmp_pdu_free(&resp);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user