From bcc3ab1728da61e5519e1f01597c8da0c5bc769b Mon Sep 17 00:00:00 2001 From: Nigel Croxon Date: Tue, 16 Jul 2024 07:19:34 -0400 Subject: [PATCH 124/201] mdadm: Query.c fix coverity issues Fixing the following coding errors the coverity tools found: * Event leaked_storage: Variable "sra" going out of scope leaks the storage it points to. * Event uninit_use_in_call: Using uninitialized value "larray_size" when calling "human_size_brief". Signed-off-by: Nigel Croxon --- Query.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Query.c b/Query.c index adcd231e..aedb4ce7 100644 --- a/Query.c +++ b/Query.c @@ -39,7 +39,7 @@ int Query(char *dev) struct mdinfo info; struct mdinfo *sra; struct supertype *st = NULL; - unsigned long long larray_size; + unsigned long long larray_size = 0; struct stat stb; char *mddev; mdu_disk_info_t disc; @@ -136,5 +136,7 @@ int Query(char *dev) if (st->ss == &super0) put_md_name(mddev); } + free(sra); + return 0; } -- 2.41.0