From 5f3cfa485eb46902e55c6b96c80dc8c57ddf3b43 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Tue, 22 Feb 2022 10:41:20 +0100 Subject: lib: Use safe wrappers around libpciaccess initialization functions Multiple calls to igt functions using pci_system_init() provided by libpciaccess result in memory leaking if not followed by its counterpart pci_system_cleanup() before next use. On the other hand, calling pci_system_cleanup() can affect other users which still depend on global data initialized by pci_system_init(). Introduce safe IGT wrappers around those libpciaccess functions and use those wrappers in IGT library and tests. Signed-off-by: Janusz Krzysztofik [jkrzyszt: shorten excessive long name of hidden variable (Chris)] Reviewed-by: Chris Wilson --- lib/igt_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/igt_device.c') diff --git a/lib/igt_device.c b/lib/igt_device.c index 07bb0a0d..c50bf4a1 100644 --- a/lib/igt_device.c +++ b/lib/igt_device.c @@ -193,7 +193,7 @@ static struct pci_device *__igt_device_get_pci_device(int fd) return NULL; } - if (pci_system_init()) { + if (igt_pci_system_init()) { igt_warn("Couldn't initialize PCI system\n"); return NULL; } -- cgit v1.2.3