[SSSD] [PATCHES] fix minor memory leaks

Pavel Reichl preichl at redhat.com
Fri Sep 4 12:21:59 UTC 2015



On 09/04/2015 01:56 PM, Jakub Hrozek wrote:
> On Fri, Sep 04, 2015 at 01:09:36PM +0200, Pavel Reichl wrote:
>> Hello,
>>
>> please see simple patch set fixing minor memory leaks of providers. I'm not aware of any user hitting those currently.
>>
>> Thanks!
>
>>  From ef62f0245cde314fd11b1cd2584589e018ede050 Mon Sep 17 00:00:00 2001
>> From: Pavel Reichl <preichl at redhat.com>
>> Date: Fri, 4 Sep 2015 07:02:42 -0400
>> Subject: [PATCH 1/4] AD: fix minor memory leak
>>
>> ---
>>   src/providers/ad/ad_common.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
>> index 130cdeb613aae3843f7453a478815daaae6aab77..aca550581708e6501c99f1c69e3c5ec9303d3b8c 100644
>> --- a/src/providers/ad/ad_common.c
>> +++ b/src/providers/ad/ad_common.c
>> @@ -658,7 +658,7 @@ ad_failover_init(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
>>       TALLOC_CTX *tmp_ctx;
>>       struct ad_service *service;
>>
>> -    tmp_ctx = talloc_new(mem_ctx);
>> +    tmp_ctx = talloc_new(NULL);
>
> I don't think we should do this kind of change, it's quite possible
> we'll start using talloc pools soon which will make us migrate from
> using NULL context.
OK, I just find the usage of tmp_ctx somewhat awkward in this function. I think function would be better off without it completely - service would be allocated directly on mem_ctx. But I agree this is not a bug and possibly just a matter of personal 
preference, so we can ignore that.

>
> Just make sure tmp_ctx is freed as appropriate.
>
> I haven't reviewed the rest of the patches.
>
>>       if (!tmp_ctx) return ENOMEM;
> _______________________________________________
> sssd-devel mailing list
> sssd-devel at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>


More information about the sssd-devel mailing list