summaryrefslogtreecommitdiffstats
path: root/tools/lvresize.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2009-07-07 01:18:35 +0000
committerDave Wysochanski <dwysocha@redhat.com>2009-07-07 01:18:35 +0000
commit4c611a220ac723cc94dfb9235a354e57e0c895d7 (patch)
tree6d99fc33213f1a7abe0971674d3073b543e52525 /tools/lvresize.c
parent1ad6d98bbe353eda73479866a8f35670876aec69 (diff)
downloadlvm2-4c611a220ac723cc94dfb9235a354e57e0c895d7.tar.gz
lvm2-4c611a220ac723cc94dfb9235a354e57e0c895d7.tar.xz
lvm2-4c611a220ac723cc94dfb9235a354e57e0c895d7.zip
Fix vg_read() error paths to properly release upon vg_read_error().
Fix vg_read() error paths to properly release upon vg_read_error(). Note that in the iterator paths (process_each_*()), we release inside the iterator so no individual cleanup is needed. However there are a number of other places we missed the cleanup. Proper cleanup when vg_read_error() is true should be calling vg_release(vg), since there should be no locks held if we get an error (except in certain special cases, which IMO we should work to remove from the code). Unfortunately the testsuite is unable to detect these types of memory leaks. Most of them can be easily seen if you try an operation (e.g. lvcreate) with a volume group that does not exist. Error message looks like this: Volume group "vg2" not found You have a memory leak (not released memory pool): [0x1975eb8] You have a memory leak (not released memory pool): [0x1975eb8] Author: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'tools/lvresize.c')
-rw-r--r--tools/lvresize.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/lvresize.c b/tools/lvresize.c
index b5587921..033078f3 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -673,6 +673,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Finding volume group %s", lp.vg_name);
vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0);
if (vg_read_error(vg)) {
+ vg_release(vg);
stack;
return ECMD_FAILED;
}