swr: refactor swr_create_screen to allow for proper cleanup on error
authorChuck Atkins <chuck.atkins@kitware.com>
Mon, 22 Jan 2018 17:09:28 +0000 (12:09 -0500)
committerGeorge Kyriazis <george.kyriazis@intel.com>
Mon, 22 Jan 2018 23:56:44 +0000 (17:56 -0600)
commita29d63ecf71546c4798c609e37810f0ec81793d8
tree3b3a784fa47513dd284fd1f877bd8421841290bf
parent56b9060381a02e9e3545c7eda3c281034a7e9b10
swr: refactor swr_create_screen to allow for proper cleanup on error

This makes the following changes to address cleanup issues:
- Error conditions now return NULL instead of calling exit()
- swr_creen is now freed upon error, rather than leak.
- Library handle from dlopen is now closed upon swr_screen destruction

v2: Added additional context in commit msg and remove unnecessary "PUBLIC"
v3: Fix typo in commit message.

Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
Cc: Tim Rowley <timothy.o.rowley@intel.com>
cc: mesa-stable@lists.freedesktop.org
src/gallium/drivers/swr/swr_loader.cpp
src/gallium/drivers/swr/swr_public.h
src/gallium/drivers/swr/swr_screen.cpp
src/gallium/drivers/swr/swr_screen.h