summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-05-23 13:02:36 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2012-05-23 13:02:36 +0000
commit8cdb78d0dd6e8f9a8d130712c3ce5a676a8755c1 (patch)
treea8189d3b14adf856a9212e1ff40bc0e3163218ba /lib
parent8db4540263f607e2113a405953000527ffd34b3c (diff)
downloadlvm2-8cdb78d0dd6e8f9a8d130712c3ce5a676a8755c1.tar.gz
lvm2-8cdb78d0dd6e8f9a8d130712c3ce5a676a8755c1.tar.xz
lvm2-8cdb78d0dd6e8f9a8d130712c3ce5a676a8755c1.zip
Fix error path
Do not increase nr_filt in case of NULL ret value, since the error path doesn't handle NULL pointers.
Diffstat (limited to 'lib')
-rw-r--r--lib/commands/toolcontext.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index a352afe3..78f0801e 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -759,17 +759,19 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
log_very_verbose("devices/filter not found in config file: "
"no regex filter installed");
- else if (!(filters[nr_filt++] = regex_filter_create(cn->v))) {
+ else if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
log_error("Failed to create regex device filter");
goto bad;
- }
+ } else
+ nr_filt++;
/* device type filter. Required. */
cn = find_config_tree_node(cmd, "devices/types");
- if (!(filters[nr_filt++] = lvm_type_filter_create(cmd->proc_dir, cn))) {
+ if (!(filters[nr_filt] = lvm_type_filter_create(cmd->proc_dir, cn))) {
log_error("Failed to create lvm type filter");
goto bad;
}
+ nr_filt++;
/* md component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, "devices/md_component_detection",