]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Do not leak memory when fuzzing
authorDonald Sharp <sharpd@nvidia.com>
Tue, 3 Aug 2021 19:51:59 +0000 (15:51 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Mon, 15 Nov 2021 22:12:33 +0000 (17:12 -0500)
When executing a fuzzing target there exists a code path
where we allocate memory and then drop it immediately
because the fuzzing does not actually schedule threads of
execution.

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

index 16aa74d915050f1e460eb299d528259fec1bd1f9..661ecc855206201c1f285c17dc4635de507a30c6 100644 (file)
@@ -3580,6 +3580,9 @@ void ospf_schedule_lsa_flood_area(struct ospf_area *area, struct ospf_lsa *lsa)
        data->lsa = ospf_lsa_lock(lsa); /* Message / Flood area */
 
        thread_add_event(master, ospf_lsa_action, data, 0, NULL);
+#ifdef FUZZING
+       XFREE(MTYPE_OSPF_MESSAGE, data);
+#endif
 }
 
 void ospf_schedule_lsa_flush_area(struct ospf_area *area, struct ospf_lsa *lsa)
@@ -3592,6 +3595,9 @@ void ospf_schedule_lsa_flush_area(struct ospf_area *area, struct ospf_lsa *lsa)
        data->lsa = ospf_lsa_lock(lsa); /* Message / Flush area */
 
        thread_add_event(master, ospf_lsa_action, data, 0, NULL);
+#ifdef FUZZING
+       XFREE(MTYPE_OSPF_MESSAGE, data);
+#endif
 }