From 88b076bd3c6bf1c17c413243f9b04e28cfddc687 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 21 Apr 2016 17:35:37 -0700 Subject: [PATCH] lib: dns: Clean up allocated structure on error exit. Signed-off-by: Jeremy Allison --- lib/addns/dnsgss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c index f7ed1d1..fd1af7e 100644 --- a/lib/addns/dnsgss.c +++ b/lib/addns/dnsgss.c @@ -89,6 +89,8 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, struct gss_buffer_desc_struct input_desc, *input_ptr, output_desc; OM_uint32 major, minor; OM_uint32 ret_flags; + struct dns_request *req = NULL; + struct dns_buffer *buf = NULL; DNS_ERROR err; gss_OID_desc krb5_oid_desc = @@ -112,9 +114,7 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, if (output_desc.length != 0) { - struct dns_request *req; struct dns_rrec *rec; - struct dns_buffer *buf; time_t t = time(NULL); @@ -143,12 +143,13 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, if (!ERR_DNS_IS_OK(err)) goto error; - err = dns_marshall_request(req, req, &buf); + err = dns_marshall_request(mem_ctx, req, &buf); if (!ERR_DNS_IS_OK(err)) goto error; err = dns_send(conn, buf); if (!ERR_DNS_IS_OK(err)) goto error; + TALLOC_FREE(buf); TALLOC_FREE(req); } @@ -162,7 +163,6 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, if (major == GSS_S_CONTINUE_NEEDED) { struct dns_request *resp; - struct dns_buffer *buf; struct dns_tkey_record *tkey; struct dns_rrec *tkey_answer = NULL; uint16_t i; @@ -210,6 +210,8 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, error: + TALLOC_FREE(buf); + TALLOC_FREE(req); return err; } -- 2.5.0