On Fri, 2009-11-06 at 08:12 -0500, Simo Sorce wrote:
> On Fri, 2009-11-06 at 13:37 +0100, Martin Nagy wrote:
> > Simple one-liner.
> 
> Nack, just remove the else free completely.
> It will be freed anyway as soon as you return from the function in 99%
> of the cases as the first thing after the _recv() is usually to free the
> request.
> 
> Simo.

As you wish. But in that case, I'll do the same for the two other
functions for consistency. New patch attached.

Martin
>From 67198b93a723b3d6f568ddda6febe6b4de673892 Mon Sep 17 00:00:00 2001
From: Martin Nagy <mn...@redhat.com>
Date: Wed, 4 Nov 2009 18:19:31 +0100
Subject: [PATCH] Fix a bad free in async_resolv.c

Also remove redundant talloc_free()'s. They are not needed since their
parent should be freed right after calling the _recv() function.
---
 server/resolv/async_resolv.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/server/resolv/async_resolv.c b/server/resolv/async_resolv.c
index c13fd87..f567a39 100644
--- a/server/resolv/async_resolv.c
+++ b/server/resolv/async_resolv.c
@@ -411,8 +411,6 @@ resolv_gethostbyname_recv(TALLOC_CTX *mem_ctx, struct tevent_req *req,
         *timeouts = state->timeouts;
     if (hostent)
         *hostent = talloc_steal(mem_ctx, state->hostent);
-    else
-        talloc_free(hostent);
 
     if (tevent_req_is_error(req, &tstate, &err)) {
         return -1;
@@ -595,8 +593,6 @@ resolv_getsrv_recv(TALLOC_CTX *mem_ctx, struct tevent_req *req, int *status,
         *timeouts = state->timeouts;
     if (reply_list)
         *reply_list = talloc_steal(mem_ctx, state->reply_list);
-    else
-        talloc_free(state->reply_list);
     if (num_replies)
         *num_replies = state->num_replies;
 
@@ -779,8 +775,6 @@ resolv_gettxt_recv(TALLOC_CTX *mem_ctx, struct tevent_req *req, int *status,
         *timeouts = state->timeouts;
     if (reply_list)
         *reply_list = talloc_steal(mem_ctx, state->reply_list);
-    else
-        talloc_free(state->reply_list);
     if (num_replies)
         *num_replies = state->num_replies;
 
-- 
1.6.2.5

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to