mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
common: fix double-close in error_handler()
This commit is contained in:
parent
70ca8b6041
commit
f53ddbe800
1 changed files with 1 additions and 3 deletions
|
@ -145,7 +145,6 @@ void error_handler(int sig) {
|
||||||
size_t bt_len;
|
size_t bt_len;
|
||||||
char maps_file[256];
|
char maps_file[256];
|
||||||
char maps_buffer[1024];
|
char maps_buffer[1024];
|
||||||
FILE *maps;
|
|
||||||
|
|
||||||
sway_log(L_ERROR, "Error: Signal %d. Printing backtrace", sig);
|
sway_log(L_ERROR, "Error: Signal %d. Printing backtrace", sig);
|
||||||
bt_len = backtrace(array, max_lines);
|
bt_len = backtrace(array, max_lines);
|
||||||
|
@ -163,11 +162,10 @@ void error_handler(int sig) {
|
||||||
sway_log(L_ERROR, "Maps:");
|
sway_log(L_ERROR, "Maps:");
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
if (snprintf(maps_file, 255, "/proc/%zd/maps", (size_t)pid) < 255) {
|
if (snprintf(maps_file, 255, "/proc/%zd/maps", (size_t)pid) < 255) {
|
||||||
maps = fopen(maps_file, "r");
|
FILE *maps = fopen(maps_file, "r");
|
||||||
while (!feof(maps)) {
|
while (!feof(maps)) {
|
||||||
char *m = read_line_buffer(maps, maps_buffer, 1024);
|
char *m = read_line_buffer(maps, maps_buffer, 1024);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
fclose(maps);
|
|
||||||
sway_log(L_ERROR, "Unable to allocate memory to show maps");
|
sway_log(L_ERROR, "Unable to allocate memory to show maps");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue