diff options
author | Colin Walters <walters@verbum.org> | 2013-09-28 18:32:22 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-09-29 10:13:14 -0400 |
commit | 020fa7de344d9f10136ae1a3cb9bf6baa868218d (patch) | |
tree | bb27b1848e8298d34d8db609399ed78a8abf3177 | |
parent | 66140c018f044ba038ddb6bc1e6e97eb87d2b8f6 (diff) | |
download | libgsystem-020fa7de344d9f10136ae1a3cb9bf6baa868218d.tar.gz |
fileutil: Close fd if passed NULL for output stream
So we don't leak it.
-rw-r--r-- | gsystem-file-utils.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; |