Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix double close(2)
Bryan Drewery committed 12 years ago
commit 95c69850c019af3c12b91274cf12f8ace8e41880
parent 0604a20
1 file changed +0 -3
modified libpkg/utils.c
@@ -141,21 +141,18 @@ file_to_buffer(const char *path, char **buffer, off_t *sz)
	}

	if (fstat(fd, &st) == -1) {
-
		close(fd);
		pkg_emit_errno("fstat", path);
		retcode = EPKG_FATAL;
		goto cleanup;
	}

	if ((*buffer = malloc(st.st_size + 1)) == NULL) {
-
		close(fd);
		pkg_emit_errno("malloc", "");
		retcode = EPKG_FATAL;
		goto cleanup;
	}

	if (read(fd, *buffer, st.st_size) == -1) {
-
		close(fd);
		pkg_emit_errno("read", path);
		retcode = EPKG_FATAL;
		goto cleanup;