From 591b95644bd44976fd7cc354cb063fe1f3245784 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 3 Aug 2021 15:51:59 -0400 Subject: [PATCH] ospfd: Do not leak memory when fuzzing 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 --- ospfd/ospf_lsa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 16aa74d915..661ecc8552 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -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 } -- 2.39.5