From 7f63872dcfd0d1a3c3b678f4db2b0ac4bdd25888 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 19 Jul 2022 15:29:49 -0700 Subject: [PATCH] unit: memset band to zero after alloc In test-band the band object was allocated using l_malloc, but not memset to zero. This will cause problems if allocated pointers are included in struct band once band is freed. --- unit/test-band.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unit/test-band.c b/unit/test-band.c index 757db377..0dd9b67b 100644 --- a/unit/test-band.c +++ b/unit/test-band.c @@ -52,6 +52,8 @@ static struct band *new_band() /* band + 8 basic rates */ struct band *band = l_malloc(sizeof(struct band) + 8); + memset(band, 0, sizeof(struct band) + 8); + band->supported_rates_len = 8; band->supported_rates[0] = 12; band->supported_rates[1] = 18;