]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospf6d: Fix auth_key string memory leak
authorDonald Sharp <sharpd@nvidia.com>
Wed, 14 Dec 2022 20:22:38 +0000 (15:22 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 15 Dec 2022 16:15:33 +0000 (11:15 -0500)
When using auth keys in ospfv3, there are some memory
leaks when you change the key or remove the interface

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
ospf6d/ospf6_interface.c
ospf6d/ospf6_message.c

index 1c045cba079f545aecb17ffbfe9fe430c3f8a531..d3dd5501a43c9e2778083a45a93201ec5f13880d 100644 (file)
@@ -303,6 +303,9 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
        /* disable from area list if possible */
        ospf6_area_interface_delete(oi);
 
+       if (oi->at_data.auth_key)
+               XFREE(MTYPE_OSPF6_AUTH_MANUAL_KEY, oi->at_data.auth_key);
+
        /* Free BFD allocated data. */
        XFREE(MTYPE_TMP, oi->bfd_config.profile);
 
index 360a9db0d6e05a983339aec4b0fa3e76249375e4..fb54ebab15c83e48fea2a09f43d7093439751ba1 100644 (file)
@@ -2015,6 +2015,9 @@ static void ospf6_auth_trailer_copy_keychain_key(struct ospf6_interface *oi)
                         * these values
                         */
                        oi->at_data.hash_algo = key->hash_algo;
+                       if (oi->at_data.auth_key)
+                               XFREE(MTYPE_OSPF6_AUTH_MANUAL_KEY,
+                                     oi->at_data.auth_key);
                        oi->at_data.auth_key = XSTRDUP(
                                MTYPE_OSPF6_AUTH_MANUAL_KEY, key->string);
                        oi->at_data.key_id = key->index;