]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: Ensure rcap is freed in error case
authorDonald Sharp <sharpd@nvidia.com>
Wed, 20 Jul 2022 20:49:09 +0000 (16:49 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 11 Oct 2022 10:38:53 +0000 (10:38 +0000)
unpack_tlv_router_cap allocates memory that in the error
case is not being freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 49efc80d342d8e8373c8af040580bd7940808730)

isisd/isis_tlvs.c

index 11be3c3a7159ed7a9793bde1c98070ea2c504518..b3c3fd4b0b4db058ad8ae750e3766235f795ae96 100644 (file)
@@ -3580,9 +3580,9 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
 }
 
 static int unpack_tlv_router_cap(enum isis_tlv_context context,
-                                      uint8_t tlv_type, uint8_t tlv_len,
-                                      struct stream *s, struct sbuf *log,
-                                      void *dest, int indent)
+                                uint8_t tlv_type, uint8_t tlv_len,
+                                struct stream *s, struct sbuf *log, void *dest,
+                                int indent)
 {
        struct isis_tlvs *tlvs = dest;
        struct isis_router_cap *rcap;
@@ -3627,7 +3627,7 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context,
                                log, indent,
                                "WARNING: Router Capability subTLV length too large compared to expected size\n");
                        stream_forward_getp(s, STREAM_READABLE(s));
-
+                       XFREE(MTYPE_ISIS_TLV, rcap);
                        return 0;
                }