]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: fix memory leak in service_add_fd_store() 1483/head
authorreverendhomer <mk.43.ecko@gmail.com>
Wed, 7 Oct 2015 08:55:31 +0000 (11:55 +0300)
committerreverendhomer <mk.43.ecko@gmail.com>
Wed, 7 Oct 2015 08:55:31 +0000 (11:55 +0300)
fixes Coverity #1325767

src/core/service.c

index 8c339765a4c235de6d8a8618e51b91545f24c2ad..ce3b81398d618045794eb6f5bcf379ef150dece4 100644 (file)
@@ -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) {