]> sourceware.org Git - lvm2.git/commitdiff
libdm: report fix memleak on error path
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 22 Nov 2014 21:40:40 +0000 (22:40 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Sat, 22 Nov 2014 23:49:04 +0000 (00:49 +0100)
When _alloc_selection_node() fails, rh should be destroyed.

Use 'bad:' label since we have goto_bad with stack embeded.

libdm/libdm-report.c

index f7687504f431170bf86b423d5c39724140a9bb06..0dfbc30fa646de2fa7886d674e019d351cc8abb2 100644 (file)
@@ -2849,24 +2849,24 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
        }
 
        if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
-               return_0;
+               goto_bad;
 
        if (!_parse_or_ex(rh, selection, &fin, root))
-               goto error;
+               goto_bad;
 
        next = _skip_space(fin);
        if (*next) {
                log_error("Expecting logical operator");
                log_error(_sel_syntax_error_at_msg, next);
                log_error(_sel_help_ref_msg);
-               goto error;
+               goto bad;
        }
 
        _dm_report_init_update_types(rh, report_types);
 
        rh->selection_root = root;
        return rh;
-error: 
+bad:
        dm_report_free(rh);
        return NULL;
 }
This page took 0.046532 seconds and 5 git commands to generate.