summaryrefslogtreecommitdiffstats
path: root/tools/dmsetup.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2009-12-11 13:04:30 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2009-12-11 13:04:30 +0000
commitc8d8f74188574b8819a86e34f35b3c58e35f8bc6 (patch)
tree0abdbd0a4aee0e62ba7500306b4102909ef8ddb7 /tools/dmsetup.c
parent2df53fc3d0eeb8dd859d6770fadaca0af2e6661c (diff)
downloadlvm2-c8d8f74188574b8819a86e34f35b3c58e35f8bc6.tar.gz
lvm2-c8d8f74188574b8819a86e34f35b3c58e35f8bc6.tar.xz
lvm2-c8d8f74188574b8819a86e34f35b3c58e35f8bc6.zip
Fix coredump and memory leak for 'dmsetup help -c'
Diffstat (limited to 'tools/dmsetup.c')
-rw-r--r--tools/dmsetup.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 888edffb..5fbc295b 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2402,7 +2402,7 @@ static int _report_init(struct command *c)
size_t len = 0;
int r = 0;
- if (!strcmp(c->name, "splitname"))
+ if (c && !strcmp(c->name, "splitname"))
options = (char *) splitname_report_options;
/* emulate old dmsetup behaviour */
@@ -2591,7 +2591,11 @@ static int _help(int argc __attribute((unused)),
_switches[OPTIONS_ARG] = 1;
_string_args[OPTIONS_ARG] = (char *) "help";
_switches[SORT_ARG] = 0;
-
+
+ if (_report) {
+ dm_report_free(_report);
+ _report = NULL;
+ }
(void) _report_init(NULL);
}