Re: [PATCH] tests: fix test segfault when libxl configuration setup fails.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 02, 2018 at 01:06:39AM -0300, Julio Faracco wrote:
> This commit fixes a segmentation fault caused by missing conditional to
> check if libxl configuration was properly created by the test. If the
> configuration was not properly created, libxlDriverConfigNew() function
> will return NULL and cause a segfault at cfg->caps = NULL during the
> cleanup.
>
> Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
> ---
>  tests/libxlxml2domconfigtest.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
> index 34a63e22b5..a9758c40cb 100644
> --- a/tests/libxlxml2domconfigtest.c
> +++ b/tests/libxlxml2domconfigtest.c
> @@ -138,7 +138,8 @@ testCompareXMLToDomConfig(const char *xmlfile,
>      libxl_domain_config_dispose(&actualconfig);
>      libxl_domain_config_dispose(&expectconfig);
>      xtl_logger_destroy(log);
> -    cfg->caps = NULL;
> +    if (cfg)
> +        cfg->caps = NULL;
>      virObjectUnref(cfg);
>      return ret;

Either this or move the "if (!(cfg - libxlDriverConfigNew()))" before the calls
to the libxl library and return a failure right away, but I don't have a strong
preference here, so

Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux