diff --git a/tnt/tnt_auth.c b/tnt/tnt_auth.c index f4d6047..ffb490b 100644 --- a/tnt/tnt_auth.c +++ b/tnt/tnt_auth.c @@ -76,11 +76,11 @@ tnt_auth_raw(struct tnt_stream *s, const char *user, int ulen, v[3].iov_len = ulen; body_start = data; data = mp_encode_uint(data, TNT_TUPLE); + char salt[64], scramble[TNT_SCRAMBLE_SIZE]; if (!guest) { data = mp_encode_array(data, 2); data = mp_encode_str(data, "chap-sha1", strlen("chap-sha1")); data = mp_encode_strl(data, TNT_SCRAMBLE_SIZE); - char salt[64], scramble[TNT_SCRAMBLE_SIZE]; base64_decode(base64_salt, TNT_SALT_SIZE, salt, 64); tnt_scramble_prepare(scramble, salt, pass, plen); v[5].iov_base = scramble; diff --git a/tnt/tnt_io.c b/tnt/tnt_io.c index f0835fc..a06b500 100644 --- a/tnt/tnt_io.c +++ b/tnt/tnt_io.c @@ -68,7 +68,8 @@ tnt_io_resolve(struct sockaddr_in *addr, addr->sin_family = AF_INET; addr->sin_port = htons(port); struct addrinfo *addr_info = NULL; - if (getaddrinfo(hostname, NULL, NULL, &addr_info) == 0) { + if (getaddrinfo(hostname, NULL, NULL, &addr_info) == 0 && + addr_info != NULL) { memcpy(&addr->sin_addr, (void*)&((struct sockaddr_in *)addr_info->ai_addr)->sin_addr, sizeof(addr->sin_addr)); diff --git a/tnt/tnt_object.c b/tnt/tnt_object.c index cd83d90..da659ce 100644 --- a/tnt/tnt_object.c +++ b/tnt/tnt_object.c @@ -332,7 +332,7 @@ ssize_t tnt_object_vformat(struct tnt_stream *s, const char *fmt, va_list vl) if ((rv = tnt_object_add_map(s, 0)) == -1) return -1; result += rv; - } if (f[0] == ']' || f[0] == '}') { + } else if (f[0] == ']' || f[0] == '}') { if ((rv = tnt_object_container_close(s)) == -1) return -1; result += rv; diff --git a/tnt/tnt_request.c b/tnt/tnt_request.c index 0f84a6b..faa524c 100644 --- a/tnt/tnt_request.c +++ b/tnt/tnt_request.c @@ -312,11 +312,12 @@ tnt_request_writeout(struct tnt_stream *s, struct tnt_request *req, v[v_sz++].iov_len = pos - begin; } mp_encode_map(map, nd); - size_t plen = 0; nd = 0; + + size_t plen = 0; for (int i = 1; i < v_sz; ++i) plen += v[i].iov_len; - nd = mp_sizeof_luint32(plen); - v[0].iov_base -= nd; - v[0].iov_len += nd; + size_t hlen = mp_sizeof_luint32(plen); + v[0].iov_base -= hlen; + v[0].iov_len += hlen; mp_encode_luint32(v[0].iov_base, plen); ssize_t rv = s->writev(s, v, v_sz); if (rv == -1) diff --git a/tnt/tnt_schema.c b/tnt/tnt_schema.c index 5dd5d03..ffe4bb8 100644 --- a/tnt/tnt_schema.c +++ b/tnt/tnt_schema.c @@ -300,7 +300,7 @@ void tnt_schema_flush(struct tnt_schema *obj) { void tnt_schema_free(struct tnt_schema *obj) { if (obj == NULL) - return NULL; + return; tnt_schema_space_free(obj->space_hash); mh_assoc_delete(obj->space_hash); }