From 020fa7de344d9f10136ae1a3cb9bf6baa868218d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 28 Sep 2013 18:32:22 -0400 Subject: fileutil: Close fd if passed NULL for output stream So we don't leak it. --- gsystem-file-utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c index 7894aee..aef76e9 100644 --- a/gsystem-file-utils.c +++ b/gsystem-file-utils.c @@ -508,6 +508,8 @@ gs_file_open_in_tmpdir_at (int tmpdir_fd, gs_transfer_out_value (out_name, &tmp_name); if (out_stream) *out_stream = g_unix_output_stream_new (fd, TRUE); + else + (void) close (fd); out: g_free (tmp_name); return ret; -- cgit v1.2.1