mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 04:27:00 +00:00
Do not leak opened file, from lg65438805 at gmail dot com in GitHub
issue 4577.
This commit is contained in:
5
file.c
5
file.c
@ -364,7 +364,7 @@ file_read(struct client *c, const char *path, client_file_cb cb, void *cbdata)
|
||||
size_t msglen;
|
||||
int fd = -1;
|
||||
u_int stream = file_next_stream++;
|
||||
FILE *f;
|
||||
FILE *f = NULL;
|
||||
size_t size;
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
@ -404,7 +404,6 @@ file_read(struct client *c, const char *path, client_file_cb cb, void *cbdata)
|
||||
cf->error = EIO;
|
||||
goto done;
|
||||
}
|
||||
fclose(f);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -427,6 +426,8 @@ skip:
|
||||
return cf;
|
||||
|
||||
done:
|
||||
if (f != NULL)
|
||||
fclose(f);
|
||||
file_fire_done(cf);
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user