You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdadm/SOURCES/0124-mdadm-Query.c-fix-cove...

43 lines
1.0 KiB

From bcc3ab1728da61e5519e1f01597c8da0c5bc769b Mon Sep 17 00:00:00 2001
From: Nigel Croxon <ncroxon@redhat.com>
Date: Tue, 16 Jul 2024 07:19:34 -0400
Subject: [PATCH 124/157] 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 <ncroxon@redhat.com>
---
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