Blob Blame History Raw
diff --git a/portlist.cc b/portlist.cc
index 48b4794..76908b5 100644
--- a/portlist.cc
+++ b/portlist.cc
@@ -722,7 +722,6 @@ int PortList::forgetPort(u16 portno, u8 protocol) {
   state_counts_proto[protocol][answer->state]--;
   state_counts_proto[protocol][default_port_state[protocol].state]++;
 
-  delete answer;
 
   port_list[protocol][portno] = NULL;
 
@@ -733,6 +732,7 @@ int PortList::forgetPort(u16 portno, u8 protocol) {
     log_flush(LOG_STDOUT);
   }
 
+  delete answer;
   return 0;
 }