summaryrefslogtreecommitdiff
path: root/source3/libaddns/dnssock.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libaddns/dnssock.c')
-rw-r--r--source3/libaddns/dnssock.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/libaddns/dnssock.c b/source3/libaddns/dnssock.c
index 5dbedc4fd51..6ceefb4e32d 100644
--- a/source3/libaddns/dnssock.c
+++ b/source3/libaddns/dnssock.c
@@ -264,9 +264,13 @@ static DNS_ERROR dns_receive_tcp(TALLOC_CTX *mem_ctx,
buf->size = ntohs(len);
- if (!(buf->data = TALLOC_ARRAY(buf, uint8, buf->size))) {
- TALLOC_FREE(buf);
- return ERROR_DNS_NO_MEMORY;
+ if (buf->size) {
+ if (!(buf->data = TALLOC_ARRAY(buf, uint8, buf->size))) {
+ TALLOC_FREE(buf);
+ return ERROR_DNS_NO_MEMORY;
+ }
+ } else {
+ buf->data = NULL;
}
err = read_all(conn->s, buf->data, buf->size);