Fix file descriptor leak in turfwar.c

This commit is contained in:
Justine Tunney 2022-10-03 08:34:04 -07:00
parent 91e167caaf
commit 6ba3b448f3
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -652,7 +652,6 @@ bool ReloadAsset(struct Asset *a) {
FormatUnixHttpDateTime(lastmod, st.st_mtim.tv_sec);
CHECK_SYS((rc = read(fd, data.p, st.st_size)));
if (rc != st.st_size) goto OnError;
close(fd);
gzip = Gzip(data);
//!//!//!//!//!//!//!//!//!//!//!//!//!/
nsync_mu_lock(&a->lock);
@ -667,6 +666,7 @@ bool ReloadAsset(struct Asset *a) {
free(f[0]);
free(f[1]);
}
close(fd);
return true;
OnError:
free(data.p);