diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-04-20 10:46:21 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-04-20 10:46:21 +0000 |
commit | 43656812352e642e9901f2a83843c85da3caf9d2 (patch) | |
tree | 8436197fc640195a5ee657415c1de8d90b589b8a /usr.sbin | |
parent | 4d894ebdb7e1ead9f6a30444099716f6bbc69bd5 (diff) |
Partially revert the previous: snmp_agentx_ping() didn't leak the pdu
because it is added to a list on the handle and eventually released
later with the handle itself. This confuses leak detection tools like
clang, so at least add a comment that it is not a leak.
ok blambert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/relayd/agentx.c | 14 | ||||
-rw-r--r-- | usr.sbin/snmpd/agentx.c | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/usr.sbin/relayd/agentx.c b/usr.sbin/relayd/agentx.c index 369861436cf..e11cc612329 100644 --- a/usr.sbin/relayd/agentx.c +++ b/usr.sbin/relayd/agentx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agentx.c,v 1.3 2014/04/20 09:29:22 reyk Exp $ */ +/* $OpenBSD: agentx.c,v 1.4 2014/04/20 10:46:20 reyk Exp $ */ /* * Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org> * @@ -889,14 +889,14 @@ snmp_agentx_ping(struct agentx_handle *h) if ((pdu = snmp_agentx_ping_pdu()) == NULL) return (-1); - if ((pdu = snmp_agentx_request(h, pdu)) == NULL || - snmp_agentx_response(h, pdu) == -1) { - error = -1; - goto fail; - } + /* Attaches the pdu to the handle; will be released later */ + if ((pdu = snmp_agentx_request(h, pdu)) == NULL) + return (-1); - fail: + if (snmp_agentx_response(h, pdu) == -1) + error = -1; snmp_agentx_pdu_free(pdu); + return (error); } diff --git a/usr.sbin/snmpd/agentx.c b/usr.sbin/snmpd/agentx.c index 369861436cf..e11cc612329 100644 --- a/usr.sbin/snmpd/agentx.c +++ b/usr.sbin/snmpd/agentx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agentx.c,v 1.3 2014/04/20 09:29:22 reyk Exp $ */ +/* $OpenBSD: agentx.c,v 1.4 2014/04/20 10:46:20 reyk Exp $ */ /* * Copyright (c) 2013,2014 Bret Stephen Lambert <blambert@openbsd.org> * @@ -889,14 +889,14 @@ snmp_agentx_ping(struct agentx_handle *h) if ((pdu = snmp_agentx_ping_pdu()) == NULL) return (-1); - if ((pdu = snmp_agentx_request(h, pdu)) == NULL || - snmp_agentx_response(h, pdu) == -1) { - error = -1; - goto fail; - } + /* Attaches the pdu to the handle; will be released later */ + if ((pdu = snmp_agentx_request(h, pdu)) == NULL) + return (-1); - fail: + if (snmp_agentx_response(h, pdu) == -1) + error = -1; snmp_agentx_pdu_free(pdu); + return (error); } |