projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1163a2e
)
shared/loop-util: fix leak of fd in error path
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Fri, 6 Dec 2019 09:40:20 +0000
(10:40 +0100)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Fri, 6 Dec 2019 09:40:20 +0000
(10:40 +0100)
src/shared/loop-util.c
patch
|
blob
|
history
diff --git
a/src/shared/loop-util.c
b/src/shared/loop-util.c
index 05b0d51d979567192911123669c025891e54b445..c3d8f81d08795f05cc11c515da9835c3db8fc13a 100644
(file)
--- a/
src/shared/loop-util.c
+++ b/
src/shared/loop-util.c
@@
-58,7
+58,7
@@
int loop_device_make_full(
}
if (offset == 0 && IN_SET(size, 0, UINT64_MAX)) {
-
int copy
;
+
_cleanup_close_ int copy = -1
;
/* If this is already a block device, store a copy of the fd as it is */
@@
-71,7
+71,7
@@
int loop_device_make_full(
return -ENOMEM;
*d = (LoopDevice) {
- .fd =
copy
,
+ .fd =
TAKE_FD(copy)
,
.nr = nr,
.node = TAKE_PTR(loopdev),
.relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */