mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2025-10-29 05:40:25 -04:00
envy24control: fix file descriptor leaks in profiles
File descriptors were leaked when "Save active profile" was pressed. Add the missing calls to close. Closes: https://github.com/alsa-project/alsa-tools/pull/33 Signed-off-by: Andreas Persson <andreasp56@outlook.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
337768effa
commit
52e6481047
1 changed files with 3 additions and 0 deletions
|
|
@ -1146,13 +1146,16 @@ int save_restore(const char * const operation, const int profile_number, const i
|
|||
fprintf(stderr, "Cannot save settings for card '%d' in profile '%d'.\n", card_number, profile_number);
|
||||
return -errno;
|
||||
}
|
||||
close(res);
|
||||
unlink(cfgfile);
|
||||
} else {
|
||||
close(res);
|
||||
if ((res = open(cfgfile, O_RDWR | 0400000 /* O_NOFOLLOW */, FILE_CREA_MODE)) < 0) {
|
||||
fprintf(stderr, "Cannot open configuration file '%s' for writing.\n", cfgfile);
|
||||
fprintf(stderr, "Cannot save settings for card '%d' in profile '%d'.\n", card_number, profile_number);
|
||||
return -errno;
|
||||
}
|
||||
close(res);
|
||||
}
|
||||
res = save_profile(profile_number, card_number, profile_name, cfgfile);
|
||||
} else if (!strcmp(operation, ALSACTL_OP_RESTORE)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue