mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 02:57:16 +03:00
service: fix memory leak in service_add_fd_store()
fixes Coverity #1325767
This commit is contained in:
parent
69b8a8ebae
commit
17dec0f703
@ -363,8 +363,10 @@ static int service_add_fd_store(Service *s, int fd, const char *name) {
|
|||||||
fs->fd = fd;
|
fs->fd = fd;
|
||||||
fs->service = s;
|
fs->service = s;
|
||||||
fs->fdname = strdup(name ?: "stored");
|
fs->fdname = strdup(name ?: "stored");
|
||||||
if (!fs->fdname)
|
if (!fs->fdname) {
|
||||||
|
free(fs);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_event_add_io(UNIT(s)->manager->event, &fs->event_source, fd, 0, on_fd_store_io, fs);
|
r = sd_event_add_io(UNIT(s)->manager->event, &fs->event_source, fd, 0, on_fd_store_io, fs);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user