]> sourceware.org Git - lvm2.git/commitdiff
clvmd: fix leak of saved_vg struct
authorDavid Teigland <teigland@redhat.com>
Mon, 18 Jun 2018 19:10:48 +0000 (14:10 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 18 Jun 2018 19:14:38 +0000 (14:14 -0500)
Commit c016b573ee32f "clvmd: separate saved_vg from vginfo"
created a separate hash table for the saved_vg structs.
The vg's referenced by the saved_vg struct were all being
freed properly, but the svg wrapper struct itself was not
being freed.

lib/cache/lvmcache.c

index c306a3aa9a90dc70a3751743d7f4bf1d677075b1..1b405e703768ad80aa5c1f8c05e1c56a679d1eac 100644 (file)
@@ -295,6 +295,11 @@ static void _drop_metadata(const char *vgname, int drop_precommitted)
                _saved_vg_free(svg, 0, 1);
        else
                _saved_vg_free(svg, 1, 1);
+
+       if (!svg->saved_vg_old && !svg->saved_vg_new) {
+               dm_hash_remove(_saved_vg_hash, svg->vgid);
+               dm_free(svg);
+       }
 }
 
 void lvmcache_save_vg(struct volume_group *vg, int precommitted)
@@ -2515,6 +2520,7 @@ static void _lvmcache_destroy_lockname(struct dm_hash_node *n)
 static void _destroy_saved_vg(struct saved_vg *svg)
 {
        _saved_vg_free(svg, 1, 1);
+       dm_free(svg);
 }
 
 void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
This page took 0.034124 seconds and 5 git commands to generate.