On 05/20/19 23:36, Philippe Mathieu-Daudé wrote: > The mm_fw_cfg_init() allocates a QFWCFG object, > add mm_fw_cfg_uninit() to deallocate it. > Similarly with io_fw_cfg_init(), add io_fw_cfg_uninit(). > > Signed-off-by: Li Qiang <liq...@163.com> > Tested-by: Thomas Huth <th...@redhat.com> > Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com> > Tested-by: Philippe Mathieu-Daudé <phi...@redhat.com> > Message-Id: <20190424140643.62457-2-liq...@163.com> > [PMD: Split patch, filled commit description] > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > tests/libqos/fw_cfg.c | 10 ++++++++++ > tests/libqos/fw_cfg.h | 2 ++ > 2 files changed, 12 insertions(+) > > diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c > index d0889d1e22a..c6839c53c80 100644 > --- a/tests/libqos/fw_cfg.c > +++ b/tests/libqos/fw_cfg.c > @@ -81,6 +81,11 @@ QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base) > return fw_cfg; > } > > +void mm_fw_cfg_uninit(QFWCFG *fw_cfg) > +{ > + g_free(fw_cfg); > +} > + > static void io_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key) > { > qtest_outw(fw_cfg->qts, fw_cfg->base, key); > @@ -107,3 +112,8 @@ QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base) > > return fw_cfg; > } > + > +void io_fw_cfg_uninit(QFWCFG *fw_cfg) > +{ > + g_free(fw_cfg); > +} > diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h > index 0353416af07..391669031a3 100644 > --- a/tests/libqos/fw_cfg.h > +++ b/tests/libqos/fw_cfg.h > @@ -33,7 +33,9 @@ uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key); > uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key); > > QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base); > +void mm_fw_cfg_uninit(QFWCFG *fw_cfg); > QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base); > +void io_fw_cfg_uninit(QFWCFG *fw_cfg); > > static inline QFWCFG *pc_fw_cfg_init(QTestState *qts) > { >
Reviewed-by: Laszlo Ersek <ler...@redhat.com>