diff options
Diffstat (limited to 'lib/addns')
-rw-r--r-- | lib/addns/dnssock.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/addns/dnssock.c b/lib/addns/dnssock.c index b1d794db456..df175234397 100644 --- a/lib/addns/dnssock.c +++ b/lib/addns/dnssock.c @@ -321,13 +321,14 @@ static DNS_ERROR dns_receive_tcp(TALLOC_CTX *mem_ctx, buf->size = ntohs(len); - if (buf->size) { - if (!(buf->data = talloc_array(buf, uint8_t, buf->size))) { - TALLOC_FREE(buf); - return ERROR_DNS_NO_MEMORY; - } - } else { - buf->data = NULL; + if (buf->size == 0) { + *presult = buf; + return ERROR_DNS_SUCCESS; + } + + if (!(buf->data = talloc_array(buf, uint8_t, buf->size))) { + TALLOC_FREE(buf); + return ERROR_DNS_NO_MEMORY; } err = read_all(conn->s, buf->data, buf->size); |