fixed a potential memory leak when reusing mobike task
authorMartin Willi <martin@strongswan.org>
Fri, 19 Dec 2008 14:34:40 +0000 (14:34 -0000)
committerMartin Willi <martin@strongswan.org>
Fri, 19 Dec 2008 14:34:40 +0000 (14:34 -0000)
src/charon/sa/tasks/ike_mobike.c

index fc7df49..b2ef273 100644 (file)
@@ -521,6 +521,10 @@ static status_t process_i(private_ike_mobike_t *this, message_t *message)
                                /* start the update with the same task */
                                this->check = FALSE;
                                this->address = FALSE;
+                               if (this->natd)
+                               {
+                                       this->natd->task.destroy(&this->natd->task);
+                               }
                                this->natd = ike_natd_create(this->ike_sa, this->initiator);
                                this->ike_sa->set_pending_updates(this->ike_sa, 1);
                                return NEED_MORE;