[PATCH] testCompareXMLToArgvValidateSchema: Construct @vm from scratch

Peter Krempa pkrempa at redhat.com
Fri May 22 06:53:42 UTC 2020


On Thu, May 21, 2020 at 20:58:23 +0200, Michal Privoznik wrote:
> Currently, the @vm is passed in as an argument and
> testCompareXMLToArgvCreateArgs() is called over it which means
> under the hood qemuProcessPrepareDomain() is called. But at the
> point where ValidateSchema() is called, the domain object is
> already 'prepared', i.e. all device aliases are assigned and so

Not completely though. First pass consumes some things.

> on. But our code is not prepared to 'prepare' a domain twice - it
> simply overwrites all the pointers leading to a memory leak.
> 
> Fortunately, this is only the problem of this test.

I wanted to prevent parsing it twice, but that shouldn't be a problem
for now. Definitely it's lesser problem until we stop loading the
schema for every single test run.

> Resolve this by constructing the domain object from scratch.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  tests/qemuxml2argvtest.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list