Skip to content

Commit

Permalink
mdadm: Query.c fix coverity issues
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ncroxon authored and mtkaczyk committed Jul 16, 2024
1 parent 5cb6df3 commit bcc3ab1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -136,5 +136,7 @@ int Query(char *dev)
if (st->ss == &super0)
put_md_name(mddev);
}
free(sra);

return 0;
}

0 comments on commit bcc3ab1

Please sign in to comment.