summaryrefslogtreecommitdiffstats
path: root/tools/pvmove.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/pvmove.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/pvmove.c')
-rw-r--r--tools/pvmove.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/pvmove.c b/tools/pvmove.c
index d288e6f4..65b76068 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -387,6 +387,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
vg = _get_vg(cmd, pv_vg_name(pv));
if (vg_read_error(vg)) {
+ vg_release(vg);
stack;
return ECMD_FAILED;
}