[libgsystem] fileutil: Close fd if passed NULL for output stream
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsystem] fileutil: Close fd if passed NULL for output stream
- Date: Sun, 29 Sep 2013 14:13:35 +0000 (UTC)
commit 020fa7de344d9f10136ae1a3cb9bf6baa868218d
Author: Colin Walters <walters verbum org>
Date: Sat Sep 28 18:32:22 2013 -0400
fileutil: Close fd if passed NULL for output stream
So we don't leak it.
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]