From: Nigel Croxon Date: Tue, 16 Jul 2024 11:19:34 +0000 (-0400) Subject: mdadm: Query.c fix coverity issues X-Git-Tag: mdadm-4.4~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcc3ab1728da61e5519e1f01597c8da0c5bc769b;p=thirdparty%2Fmdadm.git 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 --- 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; }