summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gsystem-file-utils.c5
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;
}