[Openais] RE: Library core dump using evt.

Steven Dake sdake at mvista.com
Tue Jan 10 16:19:41 PST 2006


Mark,

The patches generally look good, except for the SA_AIS_ERR_LIBRARY
return codes.  I've very loath to use them if we don't have to.  Are
they absolutely necessary?

Regards
-steve


On Tue, 2006-01-10 at 10:44 -0800, Mark Haverkamp wrote:
> On Tue, 2006-01-10 at 07:23 -0800, Mark Haverkamp wrote:
> > On Mon, 2006-01-09 at 22:00 -0700, Steven Dake wrote:
> > [...]
> > > 
> > > Mark,
> > > In an OOM, I think the following line would cause some problems:
> > > 
> > >    hl = malloc(sizeof(*hl));
> > >     edi->edi_hl = hl;
> > >     hl->hl_handle = *eventHandle;
> > > 
> > > no check for zero return from malloc.
> > 
> > Yes,  I try to remember to do that everywhere.  Sometimes when I am
> > coding away I forget a check :-)
> > 
> > Thanks, I'll fix that and check all the other malloc calls too.
> > 
> 
> I looked at the evt library for malloc checks and came up with some
> patches.
> 
> 1) evt_lib_alloc.patch
> 2) evt_make_event.patch
> 3) evt_chan_open.patch
> 4) evt_attr_get.patch
> 
> 1) This fixes the handle leak on failure, the malloc check for hl and
> removes the redundant memset when creating a handle.
> 
> 2) Check malloc return and handle destroying and freeing the event on
> failure.  The event destructor will handle freeing any already allocated
> memory.  This is called by saEvtDispatch which doesn't return
> SA_AIS_ERR_NO_MEMORY, so I am returning SA_AIS_ERR_LIBRARY.
> 
> 3) Check malloc return on hl data structures.
> 
> 4) Check malloc return and back out previous mallocs before returning an
> error.  Since saEvtEventAttributesGet doesn't return
> SA_AIS_ERR_NO_MEMORY, I return SA_AIS_ERR_LIBRARY.
> 




More information about the Openais mailing list