[libgsystem] file-utils: Don't leaking fd on error path in gs_file_create()



commit 374fb6906fe866ca28f7c4702db1d1eec7dedd08
Author: Thomas Haller <thaller redhat com>
Date:   Thu Oct 31 17:53:17 2013 +0100

    file-utils: Don't leaking fd on error path in gs_file_create()
    
    This error was found by running Coverity.
    
    Signed-off-by: Thomas Haller <thaller redhat com>

 gsystem-file-utils.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c
index 41cd769..ff97e19 100644
--- a/gsystem-file-utils.c
+++ b/gsystem-file-utils.c
@@ -345,6 +345,7 @@ gs_file_create (GFile          *file,
 
   if (fchmod (fd, mode) < 0)
     {
+      close (fd);
       _set_error_from_errno (error);
       goto out;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]