From cd2f779b8d6439479b9802e9fd2c8af86f8702fb Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 4 Jun 2021 10:08:18 +0200 Subject: [PATCH] alsactl: fix lock_fd unlock in load_configuration() - error path Signed-off-by: Jaroslav Kysela --- alsactl/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alsactl/utils.c b/alsactl/utils.c index 881b505..fd4a108 100644 --- a/alsactl/utils.c +++ b/alsactl/utils.c @@ -220,15 +220,17 @@ int load_configuration(const char *file, snd_config_t **top, int *open_failed) } err = snd_config_load(config, in); snd_input_close(in); - if (lock_fd >= 0) - state_unlock(lock_fd, file); if (err < 0) { error("snd_config_load error: %s", snd_strerror(err)); out: + if (lock_fd >= 0) + state_unlock(lock_fd, file); snd_config_delete(config); snd_config_update_free_global(); return err; } else { + if (lock_fd >= 0) + state_unlock(lock_fd, file); *top = config; return 0; }