]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph.cc: close file descriptor in error case
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 13 May 2013 12:04:08 +0000 (14:04 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 14 May 2013 16:39:31 +0000 (18:39 +0200)
CID 717122 (#1 of 1): Resource leak (RESOURCE_LEAK)
  leaked_handle: Handle variable "fd" going out of scope leaks
  the handle.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/tools/ceph.cc

index 2859c86b1deeddf77d25ca8182c5787d8d3506da..fd4dbb17d7b2969e79f31bb91aaa1b6fa4e4e031 100644 (file)
@@ -232,7 +232,8 @@ int do_admin_socket(string path, string cmd)
   if (connect(fd, (struct sockaddr *) &address, 
              sizeof(struct sockaddr_un)) != 0) {
     cerr << "connect to " << path << " failed with " << cpp_strerror(errno) << std::endl;
-    return -1;
+    r = -1;
+    goto out;
   }
   
   char *buf;