mirror of
https://github.com/alsa-project/alsa-tools.git
synced 2026-02-05 04:06:31 -05:00
envy24control: fix file descriptor leaks in profiles
File descriptors were leaked when "Save active profile" was pressed. Add the missing calls to close. Signed-off-by: Andreas Persson <andreasp56@outlook.com>
This commit is contained in:
parent
5eaadd15bd
commit
262b5f1f53
1 changed files with 3 additions and 0 deletions
|
|
@ -1144,13 +1144,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);
|
fprintf(stderr, "Cannot save settings for card '%d' in profile '%d'.\n", card_number, profile_number);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
close(res);
|
||||||
unlink(cfgfile);
|
unlink(cfgfile);
|
||||||
} else {
|
} else {
|
||||||
|
close(res);
|
||||||
if ((res = open(cfgfile, O_RDWR | 0400000 /* O_NOFOLLOW */, FILE_CREA_MODE)) < 0) {
|
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 open configuration file '%s' for writing.\n", cfgfile);
|
||||||
fprintf(stderr, "Cannot save settings for card '%d' in profile '%d'.\n", card_number, profile_number);
|
fprintf(stderr, "Cannot save settings for card '%d' in profile '%d'.\n", card_number, profile_number);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
close(res);
|
||||||
}
|
}
|
||||||
res = save_profile(profile_number, card_number, profile_name, cfgfile);
|
res = save_profile(profile_number, card_number, profile_name, cfgfile);
|
||||||
} else if (!strcmp(operation, ALSACTL_OP_RESTORE)) {
|
} else if (!strcmp(operation, ALSACTL_OP_RESTORE)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue