From ba908c4eedaacb72cad1245c557591d326122c57 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 9 Jul 2014 08:50:04 +0200 Subject: [PATCH] snmp: avoid deferencing a pointer when it may be NULL --- src/daemon/agent_priv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/daemon/agent_priv.c b/src/daemon/agent_priv.c index 8efcb5e3..6a126fe8 100644 --- a/src/daemon/agent_priv.c +++ b/src/daemon/agent_priv.c @@ -84,12 +84,12 @@ agent_priv_unix_send(netsnmp_transport *t, void *buf, int size, void **opaque, int *olength) { int rc = -1; - struct pollfd sagentx = { - .fd = t->sock, - .events = POLLOUT | POLLERR | POLLHUP - }; if (t != NULL && t->sock >= 0) { + struct pollfd sagentx = { + .fd = t->sock, + .events = POLLOUT | POLLERR | POLLHUP + }; while (rc < 0) { rc = poll(&sagentx, 1, AGENT_WRITE_TIMEOUT); if (rc == 0) { -- 2.39.5