[PATCH] Fix three coverity findings
Volker Lendecke
vl at samba.org
Tue Dec 27 11:17:20 UTC 2016
Hi!
Review appreciated!
Thanks, Volker
-------------- next part --------------
>From 8a2beaf75da516540b29845b6d47bdf5c8813372 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 27 Dec 2016 10:47:10 +0000
Subject: [PATCH 1/3] ctdb: Fix CID 1398179 Argument cannot be negative
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/common/sock_daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ctdb/common/sock_daemon.c b/ctdb/common/sock_daemon.c
index 0a6573c36d5..dc5dba0b429 100644
--- a/ctdb/common/sock_daemon.c
+++ b/ctdb/common/sock_daemon.c
@@ -282,7 +282,7 @@ static int sock_socket_init(TALLOC_CTX *mem_ctx, const char *sockpath,
static int sock_socket_destructor(struct sock_socket *sock)
{
- if (sock->fd == -1) {
+ if (sock->fd != -1) {
close(sock->fd);
sock->fd = -1;
}
--
2.11.0
>From 5fd132e188cadc519b99953b39fd9494c64ef105 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 27 Dec 2016 10:48:21 +0000
Subject: [PATCH 2/3] ctdb: Fix CID 1398178 Argument cannot be negative
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/common/sock_io.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ctdb/common/sock_io.c b/ctdb/common/sock_io.c
index 7245d4e973d..b3581fc4721 100644
--- a/ctdb/common/sock_io.c
+++ b/ctdb/common/sock_io.c
@@ -53,7 +53,6 @@ int sock_connect(const char *sockpath)
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) {
D_ERR("socket() failed, errno=%d\n", errno);
- close(fd);
return -1;
}
--
2.11.0
>From 278d4d033a278640c96bba787921d2c71a2edaad Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 27 Dec 2016 10:50:29 +0000
Subject: [PATCH 3/3] ctdb: Fix CID 1398175 Dereference after null check
Signed-off-by: Volker Lendecke <vl at samba.org>
---
ctdb/server/ctdb_takeover_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ctdb/server/ctdb_takeover_helper.c b/ctdb/server/ctdb_takeover_helper.c
index 847a49d2734..3057528c8bb 100644
--- a/ctdb/server/ctdb_takeover_helper.c
+++ b/ctdb/server/ctdb_takeover_helper.c
@@ -111,7 +111,7 @@ static struct tevent_req *get_public_ips_send(
req = tevent_req_create(mem_ctx, &state, struct get_public_ips_state);
if (req == NULL) {
- return tevent_req_post(req, ev);
+ return NULL;
}
state->pnns = pnns;
--
2.11.0
More information about the samba-technical
mailing list