]> 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)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 10 Oct 2022 12:04:14 +0000 (08:04 -0400)
unpack_tlv_router_cap allocates memory that in the error
case is not being freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
isisd/isis_tlvs.c

index f1aae7caf1074895ab408bf8cdfab0d28bcb5d32..dad271225b3db07f2a1fccd7e0facfd15bd90647 100644 (file)
@@ -2966,9 +2966,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;
@@ -3013,7 +3013,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;
                }