Commit Graph

1 Commits

Author SHA1 Message Date
Kamil Dudka 990cf47f04 sync: fix open() fallback bug
Detected by Coverity Analysis:

Error: RESOURCE_LEAK (CWE-772):
coreutils-8.30/src/sync.c:112: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
coreutils-8.30/src/sync.c:112: var_assign: Assigning: "fd" = handle returned from "open(file, 2049)".
coreutils-8.30/src/sync.c:115: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
113|         if (fd < 0)
114|           error (0, rd_errno, _("error opening %s"), quoteaf (file));
115|->       return false;
116|       }
117|

Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33287
2018-11-07 16:04:59 +01:00