]> sourceware.org Git - lvm2.git/commitdiff
lvmetad: fix socket leak in handle_connect
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 14 Dec 2012 20:31:22 +0000 (21:31 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Sat, 15 Dec 2012 16:23:27 +0000 (17:23 +0100)
Close socket_fd and report error on malloc failure.

WHATS_NEW
libdaemon/server/daemon-server.c

index 2fc8acf0ee334ce4b26c89b74972dcfce9e05d9e..701d502ac91a10479368564dadc452e500a48fe1 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.99 - 
 ===================================
+  Fix socket leak on error path in lvmetad's handle_connect.
   Check for failing id_read_format() in _pv_populate_lvmcache.
   Fix memleak on error path for lvmetad's pv_found.
   Unlock vg mutex in error path when lvmetad tries to lock_vg.
index 3711419c62a84d95a4b2e622ab0c52703e9d00d2..3c84e1170721b5a881223d5baabd18a77f52a86d 100644 (file)
@@ -427,8 +427,12 @@ static int handle_connect(daemon_state s)
        if (client.socket_fd < 0)
                return 0;
 
-       if (!(baton = malloc(sizeof(struct thread_baton))))
+       if (!(baton = malloc(sizeof(struct thread_baton)))) {
+               if (close(client.socket_fd))
+                       perror("close");
+               ERROR(&s, "Failed to allocate thread baton");
                return 0;
+       }
 
        baton->s = s;
        baton->client = client;
This page took 0.047292 seconds and 5 git commands to generate.