diff options
-rw-r--r-- | usr.sbin/snmpctl/snmpctl.c | 10 | ||||
-rw-r--r-- | usr.sbin/snmpd/trap.c | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/usr.sbin/snmpctl/snmpctl.c b/usr.sbin/snmpctl/snmpctl.c index af93f91208f..f41198d22c3 100644 --- a/usr.sbin/snmpctl/snmpctl.c +++ b/usr.sbin/snmpctl/snmpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpctl.c,v 1.12 2009/12/16 22:17:53 deraadt Exp $ */ +/* $OpenBSD: snmpctl.c,v 1.13 2011/03/16 15:30:35 reyk Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> @@ -148,12 +148,14 @@ main(int argc, char *argv[]) err(1, "connect: %s", sock); } - if (res->ibuf != NULL) + if (res->ibuf != NULL) { ibuf = res->ibuf; - else + ibuf->fd = ibuf->w.fd = ctl_sock; + } else { if ((ibuf = malloc(sizeof(struct imsgbuf))) == NULL) err(1, "malloc"); - imsg_init(ibuf, ctl_sock); + imsg_init(ibuf, ctl_sock); + } done = 0; /* process user request */ diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index b04f61bcaff..a4a3660a762 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.14 2009/06/06 05:52:01 pyr Exp $ */ +/* $OpenBSD: trap.c,v 1.15 2011/03/16 15:30:35 reyk Exp $ */ /* * Copyright (c) 2008 Reyk Floeter <reyk@vantronix.net> @@ -185,11 +185,10 @@ trap_imsg(struct imsgev *iev, pid_t pid) log_debug("trap_imsg: from pid %u len %d elements %d", pid, len, x); trap_send(&o, varbind); + return (0); - ret = 0; imsgdone: - if (ret != 0) - imsg_free(&imsg); + imsg_free(&imsg); done: if (varbind != NULL) ber_free_elements(varbind); @@ -283,8 +282,6 @@ trap_send(struct ber_oid *oid, struct ber_element *elm) } done: - if (elm != NULL) - ber_unlink_elements(c); ber_free_elements(trap); ber_free(&ber); |