From c3c140b38ce1a5a5ad5e316c50707f68e6bfe2ab Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 13 May 2013 14:04:08 +0200 Subject: [PATCH] tools/ceph.cc: close file descriptor in error case 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 --- src/tools/ceph.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index 2859c86b1deed..fd4dbb17d7b29 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -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; -- 2.39.5