]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fixed resource leak
authorArvin Schnell <aschnell@suse.de>
Tue, 4 Sep 2012 09:58:30 +0000 (11:58 +0200)
committerArvin Schnell <aschnell@suse.de>
Tue, 4 Sep 2012 09:58:30 +0000 (11:58 +0200)
snapper/File.cc

index 9fc1ed676ab60c409644bdbb8ed6cfef93c28ffc..165639e9e3bff8dfe7f94c736fb3593af86f7be6 100644 (file)
@@ -339,6 +339,7 @@ namespace snapper
        if (dest_fd < 0)
        {
            y2err("open failed errno:" << errno << " (" << stringerror(errno) << ")");
+           close(src_fd);
            return false;
        }
 
@@ -346,6 +347,8 @@ namespace snapper
        if (r1 != 0)
        {
            y2err("fchmod failed errno:" << errno << " (" << stringerror(errno) << ")");
+           close(dest_fd);
+           close(src_fd);
            return false;
        }
 
@@ -353,6 +356,8 @@ namespace snapper
        if (r2 != 0)
        {
            y2err("fchown failed errno:" << errno << " (" << stringerror(errno) << ")");
+           close(dest_fd);
+           close(src_fd);
            return false;
        }
 
@@ -363,7 +368,6 @@ namespace snapper
        }
 
        close(dest_fd);
-
        close(src_fd);
 
        return ret;