From 577a065f216a7d434082eded84c0642e7adff043 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 24 May 2012 15:59:32 +0200 Subject: s4-dns: Fix an unlikely potential memleak If state was alloc'ed to NULL, in_packet to != NULL and out_packet to NULL, we leak in_packet. Signed-off-by: Kai Blin --- source4/dns_server/dns_server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c index f9db095e74..28c57c0f6e 100644 --- a/source4/dns_server/dns_server.c +++ b/source4/dns_server/dns_server.c @@ -117,8 +117,10 @@ static NTSTATUS dns_process(struct dns_server *dns, /* TODO: We don't really need an out_packet. */ out_packet = talloc_zero(state, struct dns_name_packet); - if (in_packet == NULL) return NT_STATUS_NO_MEMORY; - if (out_packet == NULL) return NT_STATUS_NO_MEMORY; + if ((state == NULL) || (in_packet == NULL) || (out_packet == NULL)) { + TALLOC_FREE(state); + return NT_STATUS_NO_MEMORY; + } dump_data(8, in->data, in->length); -- cgit