[Freeipa-devel] [PATCH 0161] ipa-range-check: Fix memory leaks when freeing range object

Tomas Babej tbabej at redhat.com
Tue Apr 1 08:05:39 UTC 2014


On 04/01/2014 09:17 AM, Tomas Babej wrote:
> On 04/01/2014 09:11 AM, Alexander Bokovoy wrote:
>> On Tue, 01 Apr 2014, Jan Pazdziora wrote:
>>> On Thu, Mar 27, 2014 at 01:14:52PM +0100, Tomas Babej wrote:
>>>> Hi,
>>>>
>>>> When cleaning the range_info struct, simple free of the struct
>>>> is not enough, we have to free contents of char pointers in the
>>>> struct as well.
>>>>
>>>> https://fedorahosted.org/freeipa/ticket/4276
>>> [...]
>>>
>>>
>>>>  1 file changed, 13 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git
>>>> a/daemons/ipa-slapi-plugins/ipa-range-check/ipa_range_check.c
>>>> b/daemons/ipa-slapi-plugins/ipa-range-check/ipa_range_check.c
>>>> index
>>>> 0ef33e5869bbcb4f721394ce35e2338095bf5d36..c877a7dc445b31b3de085aa66028d7652df6b9cc
>>>> 100644
>>>> --- a/daemons/ipa-slapi-plugins/ipa-range-check/ipa_range_check.c
>>>> +++ b/daemons/ipa-slapi-plugins/ipa-range-check/ipa_range_check.c
>>>> @@ -96,6 +96,15 @@ struct domain_info {
>>>>      struct domain_info *next;
>>>>  };
>>>>
>>>> +static void free_range_info(struct range_info *range) {
>>>> +    if (range != NULL) {
>>>> +        slapi_ch_free_string(&(range->name));
>>>> +        slapi_ch_free_string(&(range->domain_id));
>>>> +        slapi_ch_free_string(&(range->forest_root_id));
>>>> +        slapi_ch_free_string(&(range->id_range_type));
>>>> +        free(range);
>>>> +    }
>>>> +}
>>> In master, the range_info is
>>>
>>>     struct range_info {
>>>         char *name;
>>>         char *domain_id;
>>>         uint32_t base_id;
>>>         uint32_t id_range_size;
>>>         uint32_t base_rid;
>>>         uint32_t secondary_base_rid;
>>>     };
>>>
>>> -- no forest_root_id and no id_range_type.
>>>
>>> So NACK for applying to master. Perhaps there is some dependency
>>> patch?
>> I think Tomas took his own range check patch into account.
>>
>> I would also prefer splitting their dependencies. First make this one to
>> work on master, then add forest_root_id and id_range_type freeing as
>> part of the range check patches.
>>
> Yes, that was the intention. Mistake on my part, I'll send updated patches.
>

Updated patch attached.

-- 
Tomas Babej
Associate Software Engineer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-tbabej-0161-2-ipa-range-check-Fix-memory-leaks-when-freeing-range-.patch
Type: text/x-patch
Size: 2191 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20140401/74f9f39f/attachment.bin>


More information about the Freeipa-devel mailing list