diff options
author | Colin Walters <walters@verbum.org> | 2013-08-07 10:34:50 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-08-07 10:34:50 +0200 |
commit | d2deea193d946cba7778a726e45ede0ac56db715 (patch) | |
tree | 5ad98a381fb016d030d7177bcf8aca2eaafc355d | |
parent | 3dee2f23ac34d1d5ce2ed8cbad14cb0596d2b57f (diff) | |
download | libgsystem-d2deea193d946cba7778a726e45ede0ac56db715.tar.gz |
fileutils: Fix fd leak
-rw-r--r-- | gsystem-file-utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c index c25b309..28c55d9 100644 --- a/gsystem-file-utils.c +++ b/gsystem-file-utils.c @@ -454,8 +454,8 @@ gs_file_open_in_tmpdir (GFile *tmpdir, gboolean ret = FALSE; const int max_attempts = 128; guint i; - DIR *d; - int dfd; + DIR *d = NULL; + int dfd = -1; char *tmp_name = NULL; int fd; @@ -495,6 +495,7 @@ gs_file_open_in_tmpdir (GFile *tmpdir, if (out_stream) *out_stream = g_unix_output_stream_new (fd, TRUE); out: + if (d) (void) closedir (d); return ret; } |