diff --git a/SOURCES/net-snmp-5.8-agent-of-death.patch b/SOURCES/net-snmp-5.8-agent-of-death.patch
new file mode 100644
index 0000000..dcafbb1
--- /dev/null
+++ b/SOURCES/net-snmp-5.8-agent-of-death.patch
@@ -0,0 +1,122 @@
+diff -urNp a/agent/agent_trap.c b/agent/agent_trap.c
+--- a/agent/agent_trap.c	2019-02-13 13:10:36.862269252 +0100
++++ b/agent/agent_trap.c	2019-02-13 15:02:11.396042356 +0100
+@@ -174,6 +174,11 @@ _trap_version_incr(int version)
+         case SNMP_VERSION_3:
+             ++_v2_sessions;
+             break;
++#ifdef USING_AGENTX_PROTOCOL_MODULE
++        case AGENTX_VERSION_1:
++            /* agentx registers in sinks, no need to count */
++            break;
++#endif
+         default:
+             snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
+     }
+@@ -201,6 +206,11 @@ _trap_version_decr(int version)
+                 _v2_sessions = 0;
+             }
+             break;
++#ifdef USING_AGENTX_PROTOCOL_MODULE
++        case AGENTX_VERSION_1:
++            /* agentx registers in sinks, no need to count */
++            break;
++#endif
+         default:
+             snmp_log(LOG_ERR, "unknown snmp version %d\n", version);
+     }
+diff -urNp old/agent/mibgroup/agentx/master.c new/agent/mibgroup/agentx/master.c
+--- old/agent/mibgroup/agentx/master.c	2019-04-03 12:13:55.115769783 +0200
++++ new/agent/mibgroup/agentx/master.c	2019-04-10 09:49:53.277168497 +0200
+@@ -280,6 +280,11 @@ agentx_got_response(int operation,
+         netsnmp_free_delegated_cache(cache);
+         return 0;
+ 
++    case NETSNMP_CALLBACK_OP_RESEND:
++        DEBUGMSGTL(("agentx/master", "resend on session %8p req=0x%x\n",
++                    session, (unsigned)reqid));
++        return 0;
++
+     case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+         /*
+          * This session is alive 
+diff -urNp old/snmplib/snmp_api.c new/snmplib/snmp_api.c
+--- old/snmplib/snmp_api.c	2019-04-24 00:28:34.904357292 +0200
++++ new/snmplib/snmp_api.c	2019-04-24 00:24:40.101830685 +0200
+@@ -352,6 +352,7 @@ static int      snmpv3_build(u_char ** p
+                              netsnmp_pdu *pdu);
+ static int      snmp_parse_version(u_char *, size_t);
+ static int      snmp_resend_request(struct session_list *slp,
++                                    netsnmp_request_list *orp,
+                                     netsnmp_request_list *rp,
+                                     int incr_retries);
+ static void     register_default_handlers(void);
+@@ -5717,7 +5718,7 @@ _sess_process_packet_handle_pdu(void *se
+ 	     * * inifinite resend                      
+ 	     */
+ 	    if (rp->retries <= sp->retries) {
+-	      snmp_resend_request(slp, rp, TRUE);
++	      snmp_resend_request(slp, orp, rp, TRUE);
+ 	      break;
+ 	    } else {
+ 	      /* We're done with retries, so no longer waiting for a response */
+@@ -6662,9 +6663,22 @@ snmp_timeout(void)
+     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
+ }
+ 
++static void
++remove_request(struct snmp_internal_session *isp,
++               netsnmp_request_list *orp, netsnmp_request_list *rp)
++{
++    if (orp)
++        orp->next_request = rp->next_request;
++    else
++        isp->requests = rp->next_request;
++    if (isp->requestsEnd == rp)
++        isp->requestsEnd = orp;
++    snmp_free_pdu(rp->pdu);
++}
++
+ static int
+-snmp_resend_request(struct session_list *slp, netsnmp_request_list *rp,
+-                    int incr_retries)
++snmp_resend_request(struct session_list *slp, netsnmp_request_list *orp,
++                    netsnmp_request_list *rp, int incr_retries)
+ {
+     struct snmp_internal_session *isp;
+     netsnmp_session *sp;
+@@ -6731,9 +6745,11 @@ snmp_resend_request(struct session_list
+         sp->s_snmp_errno = SNMPERR_BAD_SENDTO;
+         sp->s_errno = errno;
+         snmp_set_detail(strerror(errno));
+-        if (rp->callback)
++        if (rp->callback) {
+             rp->callback(NETSNMP_CALLBACK_OP_SEND_FAILED, sp,
+                          rp->pdu->reqid, rp->pdu, rp->cb_data);
++            remove_request(isp, orp, rp);
++        }
+         return -1;
+     } else {
+         netsnmp_get_monotonic_clock(&now);
+@@ -6813,19 +6829,12 @@ snmp_sess_timeout(void *sessp)
+                     callback(NETSNMP_CALLBACK_OP_TIMED_OUT, sp,
+                              rp->pdu->reqid, rp->pdu, magic);
+                 }
+-                if (orp)
+-                    orp->next_request = rp->next_request;
+-                else
+-                    isp->requests = rp->next_request;
+-                if (isp->requestsEnd == rp)
+-                    isp->requestsEnd = orp;
+-                snmp_free_pdu(rp->pdu);
++                remove_request(isp, orp, rp); 
+                 freeme = rp;
+                 continue;       /* don't update orp below */
+             } else {
+-                if (snmp_resend_request(slp, rp, TRUE)) {
++                if (snmp_resend_request(slp, orp, rp, TRUE))
+                     break;
+-                }
+             }
+         }
+         orp = rp;
diff --git a/SPECS/net-snmp.spec b/SPECS/net-snmp.spec
index 88c5253..cd968e7 100644
--- a/SPECS/net-snmp.spec
+++ b/SPECS/net-snmp.spec
@@ -10,7 +10,7 @@
 Summary:    A collection of SNMP protocol tools and libraries
 Name:       net-snmp
 Version:    5.8
-Release:    7%{?dist}
+Release:    7%{?dist}.1
 Epoch:      1
 
 License:    BSD
@@ -41,6 +41,7 @@ Patch12:    net-snmp-5.8-autofs-skip.patch
 Patch13:    net-snmp-5.8-usage-exit.patch
 Patch14:    net-snmp-5.8-coverity.patch
 Patch15:    net-snmp-5.8-ipv6-clientaddr.patch
+Patch16:    net-snmp-5.8-agent-of-death.patch
 
 # Modern RPM API means at least EL6
 Patch101:   net-snmp-5.8-modern-rpm-api.patch
@@ -181,6 +182,7 @@ rm -r python
 %patch13 -p1 -b .usage-fix
 %patch14 -p1 -b .coverity
 %patch15 -p1 -b .ipv6-clientaddr
+%patch16 -p1 -b .agent-of-death
 
 %patch101 -p1 -b .modern-rpm-api
 
@@ -434,6 +436,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
 %{_libdir}/libnetsnmptrapd*.so.%{soname}*
 
 %changelog
+* Fri May 10 2019 Josef Ridky <jridky@redhat.com> - 1:5.8-7.1
+- fix daemon segfault during resend request (#1707530)
+
 * Thu Feb 07 2019 Josef Ridky <jridky@redhat.com> - 1:5.8-7
 - fix address assigning for IPv6 clientaddr option (#1672668)