From be8b0685a55700c6bce3681734800ec6434b0364 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Apr 2007 02:39:34 +0000 Subject: r22589: Make TALLOC_ARRAY consistent across all uses. Jeremy. (This used to be commit 8968808c3b5b0208cbad9ac92eaf948f2c546dd9) --- source3/libaddns/dnsrecord.c | 10 +++++++--- source3/libaddns/dnssock.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'source3/libaddns') diff --git a/source3/libaddns/dnsrecord.c b/source3/libaddns/dnsrecord.c index 37a5886af70..c649dbd7de4 100644 --- a/source3/libaddns/dnsrecord.c +++ b/source3/libaddns/dnsrecord.c @@ -234,9 +234,13 @@ DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, if (!ERR_DNS_IS_OK(buf.error)) goto error; - if (!(tkey->key = TALLOC_ARRAY(tkey, uint8, tkey->key_length))) { - buf.error = ERROR_DNS_NO_MEMORY; - goto error; + if (tkey->key_length) { + if (!(tkey->key = TALLOC_ARRAY(tkey, uint8, tkey->key_length))) { + buf.error = ERROR_DNS_NO_MEMORY; + goto error; + } + } else { + tkey->key = NULL; } dns_unmarshall_buffer(&buf, tkey->key, tkey->key_length); 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); -- cgit