diff options
author | Imre Deak <imre.deak@intel.com> | 2020-07-07 16:18:12 +0300 |
---|---|---|
committer | Imre Deak <imre.deak@intel.com> | 2020-07-08 13:01:10 +0300 |
commit | d0e473d7a6ef069b3ee097ebca1033c6bb9e7878 (patch) | |
tree | 61626ae3d749745564967c046d73dcee85742da3 /lib/igt_chamelium.c | |
parent | 90254c14f4e68bec9d4a114ddf039075f3c1a30c (diff) |
lib/igt_chamelium: Sanitize the init error and deinit path
Always return NULL from init in case of an error, and reuse
chamelium_deinit_rpc_only() for symmetry with init, instead of
open-coding the same.
Cc: Lyude Paul <lyude@redhat.com>
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
Diffstat (limited to 'lib/igt_chamelium.c')
-rw-r--r-- | lib/igt_chamelium.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c index 58e01ab7..5924e561 100644 --- a/lib/igt_chamelium.c +++ b/lib/igt_chamelium.c @@ -2512,7 +2512,8 @@ struct chamelium *chamelium_init(int drm_fd) return chamelium; error: chamelium_deinit_rpc_only(chamelium); - return chamelium; + + return NULL; } /** @@ -2550,12 +2551,11 @@ void chamelium_deinit(struct chamelium *chamelium) } xmlrpc_client_destroy(chamelium->client); - xmlrpc_env_clean(&chamelium->env); for (i = 0; i < chamelium->port_count; i++) free(chamelium->ports[i].name); - free(chamelium); + chamelium_deinit_rpc_only(chamelium); } bool chamelium_plug_all(struct chamelium *chamelium) |