NFD+ndn-cxx: Fix potential segfaults

Two cases that segfaults were observed:
- PIT entry can become detached, but not completely deleted.
  Measurement table lookup using such an entry results in a segfault.
- Scheduler::CancelAllEvents didn't consider event queue update while
  processing the queue.

Change-Id: I10933b5c96fd95bc395a1d08642a1e07e826da18
diff --git a/NFD b/NFD
index bc600d7..f9d4088 160000
--- a/NFD
+++ b/NFD
@@ -1 +1 @@
-Subproject commit bc600d7ccc3d2bf27e8305cc1d2a5780e10c81d4
+Subproject commit f9d4088900ef4e970150607fceedf4b1723c4081
diff --git a/ndn-cxx b/ndn-cxx
index 787be41..51af49f 160000
--- a/ndn-cxx
+++ b/ndn-cxx
@@ -1 +1 @@
-Subproject commit 787be4185c1fd41bc6a5f418974b4c9ca9ae7f46
+Subproject commit 51af49fcc8dfa86a9069098cecbe20831443a0da