summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-10-07 11:18:27 +0200
committerDaniel Mack <github@zonque.org>2015-10-07 11:18:27 +0200
commitdc086b54305882a07aeda4cb6efcc85640f55dc1 (patch)
tree16c6ab5e48cdb9e82c74d515258b6e1bdbc6fcb2 /src
parenta99bbbdc0bad8690526be1a73de4171cf7a0c448 (diff)
parent17dec0f703bea85d6cbbae2a75d7960a5f6bb666 (diff)
Merge pull request #1483 from reverendhomer/patch-2
service: fix memory leak in service_add_fd_store()
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 8c339765a4..ce3b81398d 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -363,8 +363,10 @@ static int service_add_fd_store(Service *s, int fd, const char *name) {
fs->fd = fd;
fs->service = s;
fs->fdname = strdup(name ?: "stored");
- if (!fs->fdname)
+ if (!fs->fdname) {
+ free(fs);
return -ENOMEM;
+ }
r = sd_event_add_io(UNIT(s)->manager->event, &fs->event_source, fd, 0, on_fd_store_io, fs);
if (r < 0) {