halapi: Fix mismatch by closing backend 66/291366/2
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Apr 2023 02:23:01 +0000 (11:23 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 14 Apr 2023 01:45:34 +0000 (10:45 +0900)
Change-Id: I1bd0d6548551a35cb9c993dfc6f3094d87c8bcca
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal-api-common.c

index 47f033b..64d0f83 100644 (file)
@@ -430,7 +430,7 @@ static int __get_backend_data(enum hal_module module, unsigned int *abi_version,
                if (!info->backend->name || (len + 1 > name_size)) {
                        _E("%s: Invalid size of name[] array\n", info->module_name);
                        ret = -EINVAL;
-                       goto err_conf_exit;
+                       goto err_close_backend;
                }
 
                strncpy(name, info->backend->name, len);
@@ -443,7 +443,7 @@ static int __get_backend_data(enum hal_module module, unsigned int *abi_version,
                if (!info->backend->vendor || (len + 1 > vendor_size)) {
                        _E("%s: Invalid size of vendor[] array\n", info->module_name);
                        ret = -EINVAL;
-                       goto err_conf_exit;
+                       goto err_close_backend;
                }
 
                strncpy(vendor, info->backend->vendor, len);
@@ -451,10 +451,12 @@ static int __get_backend_data(enum hal_module module, unsigned int *abi_version,
        } else {
                _E("%s: Failed to get backend data\n", info->module_name);
                ret = -EINVAL;
-               goto err_conf_exit;
+               goto err_close_backend;
        }
        ret = 0;
 
+err_close_backend:
+       __close_backend(info);
 err_conf_exit:
        _hal_api_conf_exit();
 err_unlock: