[Freeipa-devel] [PATCH] Make Data Provider a mandatory service
Stephen Gallagher
sgallagh at redhat.com
Thu May 28 12:33:51 UTC 2009
On 05/28/2009 08:19 AM, Jakub Hrozek wrote:
> On Thu, 2009-05-28 at 07:44 -0400, Stephen Gallagher wrote:
>> Please use strcasecmp() instead of strcmp() when searching for the
>> services.
>>
>
> done.
>
>> Why are you realloc()-ing to i+2? i+1 is sufficient because you're
>> replacing one spot already allocated.
>
> Because i is not the number of strings, but rather index of the ending
> NULL. The number of strings is i+1, so you need to realloc to i+2.
>
> Jakub
You're right, I wasn't paying attention. Please make on additional
change regarding the realloc. If talloc_realloc returns NULL, you've
leaked the original memory, since it's only freed on success. It should
look something like:
char *tmp_array = talloc_realloc(ctx, ctx->services, char *, i+2)
if (tmp_array == NULL) {
return ENOMEM;
}
ctx->services = tmp_array;
At least this way, the ctx->services value remains reachable.
--
Stephen Gallagher
RHCE 804006346421761
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3258 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090528/2819ce91/attachment.p7s>
More information about the Freeipa-devel
mailing list