diff options
author | Noel Power <noel.power@suse.com> | 2019-07-09 16:02:47 +0000 |
---|---|---|
committer | Gary Lockyer <gary@samba.org> | 2019-07-24 21:33:21 +0000 |
commit | 1d651a8d5847c1ecd87d5f1bbfc7714e078d60f2 (patch) | |
tree | 229345aac93d49e45396cd7aa30317e6c1921955 /source3/lib | |
parent | be2b69fecebd35d7a60057d6515e4401d3ce1294 (diff) | |
download | samba-1d651a8d5847c1ecd87d5f1bbfc7714e078d60f2.tar.gz |
s3/lib: clang: Fix 'Acces to field results in a deref of a null pointer'
Fixes:
source3/lib/ctdbd_conn.c:415:6: warning: Access to field 'operation' results in a dereference of a null pointer (loaded from variable 'hdr') <--[clang]
if (hdr->operation == CTDB_REQ_MESSAGE) {
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/ctdbd_conn.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index d5fac572d3c..0df404c4ff2 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -398,15 +398,16 @@ static int ctdb_read_packet(int fd, int timeout, TALLOC_CTX *mem_ctx, static int ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid, TALLOC_CTX *mem_ctx, struct ctdb_req_header **result) { - struct ctdb_req_header *hdr; + struct ctdb_req_header *hdr = NULL; int ret; next_pkt: ret = ctdb_read_packet(conn->fd, conn->timeout, mem_ctx, &hdr); - if (ret != 0) { + if (hdr == NULL || ret != 0) { DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret)); cluster_fatal("failed to read data from ctdbd\n"); + return -1; } DEBUG(11, ("Received ctdb packet\n")); |