summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2023-04-27 11:52:03 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2023-04-27 15:39:21 +0200
commit5c284625963812bc4241e10fe415429c81fce9a3 (patch)
treed900690a7151462ccd12bc579ba75d1b8d371cfe /lib
parentisisd: fix flex-algo data memory leak at algorithm removal (diff)
downloadfrr-5c284625963812bc4241e10fe415429c81fce9a3.tar.xz
frr-5c284625963812bc4241e10fe415429c81fce9a3.zip
isisd, lib: clarify sizeof on flex-algo memory allocation
Use the struct instead of the pointer for flex-algo memory allocation. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/flex_algo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/flex_algo.c b/lib/flex_algo.c
index 72cefc551..b4ae86369 100644
--- a/lib/flex_algo.c
+++ b/lib/flex_algo.c
@@ -28,7 +28,8 @@ struct flex_algos *flex_algos_alloc(flex_algo_allocator_t allocator,
{
struct flex_algos *flex_algos;
- flex_algos = XCALLOC(MTYPE_FLEX_ALGO_DATABASE, sizeof(*flex_algos));
+ flex_algos =
+ XCALLOC(MTYPE_FLEX_ALGO_DATABASE, sizeof(struct flex_algos));
flex_algos->flex_algos = list_new();
flex_algos->allocator = allocator;
flex_algos->releaser = releaser;
@@ -51,7 +52,7 @@ struct flex_algo *flex_algo_alloc(struct flex_algos *flex_algos,
{
struct flex_algo *fa;
- fa = XCALLOC(MTYPE_FLEX_ALGO, sizeof(*fa));
+ fa = XCALLOC(MTYPE_FLEX_ALGO, sizeof(struct flex_algo));
fa->algorithm = algorithm;
if (flex_algos->allocator)
fa->data = flex_algos->allocator(arg);