]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
child-delete: Correctly maintain allocated reqid when recreating CHILD_SA
authorTobias Brunner <tobias@strongswan.org>
Mon, 2 Oct 2023 14:08:40 +0000 (16:08 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 13 Nov 2023 11:02:11 +0000 (12:02 +0100)
The old CHILD_SA is destroyed even before the new task is queued, this
makes sure we always maintain a reference to the reqid.

src/libcharon/sa/ikev2/tasks/child_delete.c

index 54aba2c5068a8e982f8c77f4c6718ee9a91f70eb..2e2668bbe20b46e2390b80fad9d6c92609ec0173 100644 (file)
@@ -366,7 +366,7 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
                spi = child_sa->get_spi(child_sa, TRUE);
                child_cfg = child_sa->get_config(child_sa);
                child_cfg->get_ref(child_cfg);
-               args.reqid = child_sa->get_reqid(child_sa);
+               args.reqid = child_sa->get_reqid_ref(child_sa);
                args.label = child_sa->get_label(child_sa);
                if (args.label)
                {
@@ -391,6 +391,10 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
                        }
                }
                child_cfg->destroy(child_cfg);
+               if (args.reqid)
+               {
+                       charon->kernel->release_reqid(charon->kernel, args.reqid);
+               }
                DESTROY_IF(args.label);
                if (status != SUCCESS)
                {