mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Remove unnecessary goto from token load.
This commit is contained in:
@@ -135,10 +135,13 @@ crypt_token_load_external(struct crypt_device *cd, const char *name, struct cryp
|
|||||||
token->version = token_dlvsym(cd, h, CRYPT_TOKEN_ABI_VERSION, CRYPT_TOKEN_ABI_VERSION1);
|
token->version = token_dlvsym(cd, h, CRYPT_TOKEN_ABI_VERSION, CRYPT_TOKEN_ABI_VERSION1);
|
||||||
|
|
||||||
if (!token_validate_v2(cd, ret)) {
|
if (!token_validate_v2(cd, ret)) {
|
||||||
r = -EINVAL;
|
free(CONST_CAST(void *)token->name);
|
||||||
goto err;
|
dlclose(h);
|
||||||
|
memset(token, 0, sizeof(*token));
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Token loaded, possible error here means only debug message fail and can be ignored */
|
||||||
r = snprintf(buf, sizeof(buf), "%s", token->version() ?: "");
|
r = snprintf(buf, sizeof(buf), "%s", token->version() ?: "");
|
||||||
if (r < 0 || (size_t)r >= sizeof(buf))
|
if (r < 0 || (size_t)r >= sizeof(buf))
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
@@ -149,12 +152,6 @@ crypt_token_load_external(struct crypt_device *cd, const char *name, struct cryp
|
|||||||
ret->version = 2;
|
ret->version = 2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
|
||||||
free(CONST_CAST(void *)token->name);
|
|
||||||
dlclose(h);
|
|
||||||
memset(token, 0, sizeof(*token));
|
|
||||||
|
|
||||||
return r;
|
|
||||||
#else
|
#else
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user