]> Git Repo - qemu.git/commitdiff
file-posix: Don't leak fd in hdev_get_max_segments
authorFam Zheng <[email protected]>
Tue, 14 Mar 2017 16:12:05 +0000 (00:12 +0800)
committerKevin Wolf <[email protected]>
Fri, 17 Mar 2017 11:54:06 +0000 (12:54 +0100)
This fixes a leaked fd introduced in commit 9103f1ce.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/file-posix.c

index ac6bd9fae8e08f4d9429f5db0d1cfc2d49f6b26d..53febd3767756141a7ab9e7954e57a1ba16aa336 100644 (file)
@@ -703,6 +703,9 @@ static int hdev_get_max_segments(const struct stat *st)
     }
 
 out:
+    if (fd != -1) {
+        close(fd);
+    }
     g_free(sysfspath);
     return ret;
 #else
This page took 0.028327 seconds and 4 git commands to generate.