From 7fbeea30e5ce4dbb4877910877575ed6c37dfb8c Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Fri, 5 May 2017 11:48:54 +0100 Subject: [PATCH] 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. --- daemons/dmfilemapd/dmfilemapd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c index 2dd069a73..bbaabda4b 100644 --- a/daemons/dmfilemapd/dmfilemapd.c +++ b/daemons/dmfilemapd/dmfilemapd.c @@ -266,8 +266,6 @@ static int _parse_args(int argc, char **argv, struct filemap_monitor *fm) return 0; } - memset(fm, 0, sizeof(*fm)); - /* * 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: @@ -801,6 +799,8 @@ int main(int argc, char **argv) { struct filemap_monitor fm; + memset(&fm, 0, sizeof(fm)); + if (!_parse_args(argc, argv, &fm)) { dm_free(fm.path); return 1;