From: Vincent Bernat Date: Wed, 9 Jul 2014 06:50:04 +0000 (+0200) Subject: snmp: avoid deferencing a pointer when it may be NULL X-Git-Tag: 0.7.10~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba908c4eedaacb72cad1245c557591d326122c57;p=thirdparty%2Flldpd.git snmp: avoid deferencing a pointer when it may be NULL --- 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) {