diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2021-10-05 21:25:55 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2021-10-05 21:25:55 -0300 |
| commit | 14bb568af0f734aa6ee8d3ed9ad269e810f6e32f (patch) | |
| tree | cd72c5507c691337d144064629c4509a9eb2c854 /ospf6d/ospf6_nssa.c | |
| parent | c8093b99bfdf17f2fe47d0fc556af60f73b36517 (diff) | |
ospf6d: fix memleak when translating NSSA LSA
Stop leaking 4096 bytes for each translated LSA.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_nssa.c')
| -rw-r--r-- | ospf6d/ospf6_nssa.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index b35a04545a..f43397fd26 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -402,7 +402,7 @@ static void ospf6_abr_unapprove_translates(struct ospf6 *ospf6) static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area, struct ospf6_lsa *type7) { - char *buffer; + char buffer[OSPF6_MAX_LSASIZE]; struct ospf6_lsa *lsa; struct ospf6_as_external_lsa *ext, *extnew; struct ospf6_lsa_header *lsa_header; @@ -424,7 +424,8 @@ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area, return NULL; } - buffer = XCALLOC(MTYPE_OSPF6_LSA, OSPF6_MAX_LSASIZE); + /* prepare buffer */ + memset(buffer, 0, sizeof(buffer)); lsa_header = (struct ospf6_lsa_header *)buffer; extnew = (struct ospf6_as_external_lsa *)((caddr_t)lsa_header |
