[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [Q] attr.c bug?




Alex Zeltser wrote:
> 
> (As an aside, why does attr_syntax_config even need to alloc at off the
> heap, if it's always freed upon function exit?  Why not just declare it as
> a stack variable and be done with it?  Am I missing something?)

No, I think you are right it could be allocated on stack.  But I don't
think it makes much of a difference.  This part of the code is rarely
called (just on startup, once per attribute type described in the schema)
and, moreover, it is going away.

So unless there is popular demand, I don't think a "fix" is necessary.
I may do it, however, in the course of other code mangling.  I guess I
had something in mind when I wrote it that way, but can't remember anymore
the details.  Oh, yes, I think I do.  At first I thought slapd would keep
pointers to such things before I settled for embedding the struct inside
the one slapd used.  So I allocated on the heap.  Then when the actual
at_add took form, I added code to free the struct instead of rethinking
the approach.  That's it.

Julio