1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmfilemapd: clear filemap_monitor before calling _parse_args()

If the wrong number of arguments are given, main() will attempt
to free the uninitialised pointer in fm.path.
This commit is contained in:
Bryn M. Reeves 2017-05-05 11:48:54 +01:00
parent c56d8535a7
commit 7fbeea30e5

View File

@ -266,8 +266,6 @@ static int _parse_args(int argc, char **argv, struct filemap_monitor *fm)
return 0; return 0;
} }
memset(fm, 0, sizeof(*fm));
/* /*
* We don't know the true nr_regions at daemon start time, * We don't know the true nr_regions at daemon start time,
* and it is not worth a dm_stats_list()/group walk to count: * and it is not worth a dm_stats_list()/group walk to count:
@ -801,6 +799,8 @@ int main(int argc, char **argv)
{ {
struct filemap_monitor fm; struct filemap_monitor fm;
memset(&fm, 0, sizeof(fm));
if (!_parse_args(argc, argv, &fm)) { if (!_parse_args(argc, argv, &fm)) {
dm_free(fm.path); dm_free(fm.path);
return 1; return 1;