Fix memory leak in lv_info_by_lvid
PATCH 1/1 Fix memory leak in lv_info_by_lvid
The lv_from_lvid calls internally vg_read(),
we myst relelase vg structure afterwards.
Code is called only from clvmd.
Signed-off-by Milan Broz <[email protected]>
--- lib/activate/activate.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
lib/activate/activate.c +5 -1
@@ -486,12 +486,16 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lviint lv_info_by_lvid (struct cmd_context *cmd,const char *lvid_s,struct lvinfo *info,int with_open_count,int with_read_ahead) { +int r;struct logical_volume *lv;if (!(lv =lv_from_lvid (cmd, lvid_s,0 )))return 0 ; -return _lv_info (cmd, lv,0 , info, with_open_count, with_read_ahead,0 ); + r =_lv_info (cmd, lv,0 , info, with_open_count, with_read_ahead,0 ); +vg_release (lv->vg); + +return r; }/*
Signature · 1 line
1.6.5.3