Close pipes when freeing config and kill child process on error

When freeing the config, close the pipes corresponding to that
config, so they don't get leaked.  Also, if we have an error,
send a SIGKILL to the child process in case it is blocked and
won't die just because we closed the pipes to it.
diff --git a/agent/mibgroup/ucd-snmp/pass_persist.c b/agent/mibgroup/ucd-snmp/pass_persist.c
index cc44232..221761a 100644
--- a/agent/mibgroup/ucd-snmp/pass_persist.c
+++ b/agent/mibgroup/ucd-snmp/pass_persist.c
@@ -201,6 +201,7 @@
 pass_persist_free_config(void)
 {
     struct extensible *etmp, *etmp2;
+    int i;
 
     for (etmp = persistpassthrus; etmp != NULL;) {
         etmp2 = etmp;
@@ -208,6 +209,11 @@
         unregister_mib_priority(etmp2->miboid, etmp2->miblen, etmp2->mibpriority);
         free(etmp2);
     }
+    if (persist_pipes) {
+        for (i = 0; i <= numpersistpassthrus; i++) {
+            close_persist_pipe(i);
+        }
+    }
     persistpassthrus = NULL;
     numpersistpassthrus = 0;
 }
@@ -716,6 +722,11 @@
 #endif
 
     if (persist_pipes[iindex].pid != NETSNMP_NO_SUCH_PROCESS) {
+        /*
+         * kill the child, in case we got an error and the child is not
+         * cooperating.  Ignore the return code.
+         */
+        (void)kill(persist_pipes[iindex].pid, SIGKILL);
 #if HAVE_SYS_WAIT_H
         waitpid(persist_pipes[iindex].pid, NULL, 0);
 #endif