mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
Merge pull request #9995 from yuwata/fix-usbffs
core/socket: fix memleak in the error paths in usbffs_dispatch_eps()
This commit is contained in:
commit
b8fc55cb9b
4
TODO
4
TODO
@ -1,7 +1,5 @@
|
||||
Bugfixes:
|
||||
|
||||
* the error paths in usbffs_dispatch_ep() leak memory
|
||||
|
||||
* copy.c: set the right chattrs before copying files and others after
|
||||
|
||||
External:
|
||||
@ -14,8 +12,6 @@ Janitorial Clean-ups:
|
||||
|
||||
* Rearrange tests so that the various test-xyz.c match a specific src/basic/xyz.c again
|
||||
|
||||
* copy.c: set the right chattrs before copying files and others after
|
||||
|
||||
* rework mount.c and swap.c to follow proper state enumeration/deserialization
|
||||
semantics, like we do for device.c now
|
||||
|
||||
|
@ -1359,8 +1359,10 @@ static int usbffs_dispatch_eps(SocketPort *p) {
|
||||
|
||||
n = (size_t) r;
|
||||
p->auxiliary_fds = new(int, n);
|
||||
if (!p->auxiliary_fds)
|
||||
return -ENOMEM;
|
||||
if (!p->auxiliary_fds) {
|
||||
r = -ENOMEM;
|
||||
goto clear;
|
||||
}
|
||||
|
||||
p->n_auxiliary_fds = n;
|
||||
|
||||
@ -1369,8 +1371,10 @@ static int usbffs_dispatch_eps(SocketPort *p) {
|
||||
_cleanup_free_ char *ep = NULL;
|
||||
|
||||
ep = path_make_absolute(ent[i]->d_name, p->path);
|
||||
if (!ep)
|
||||
return -ENOMEM;
|
||||
if (!ep) {
|
||||
r = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
path_simplify(ep, false);
|
||||
|
||||
@ -1379,16 +1383,20 @@ static int usbffs_dispatch_eps(SocketPort *p) {
|
||||
goto fail;
|
||||
|
||||
p->auxiliary_fds[k++] = r;
|
||||
free(ent[i]);
|
||||
}
|
||||
|
||||
return r;
|
||||
r = 0;
|
||||
goto clear;
|
||||
|
||||
fail:
|
||||
close_many(p->auxiliary_fds, k);
|
||||
p->auxiliary_fds = mfree(p->auxiliary_fds);
|
||||
p->n_auxiliary_fds = 0;
|
||||
|
||||
clear:
|
||||
for (i = 0; i < n; ++i)
|
||||
free(ent[i]);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user