[OPEN-ILS-DEV] PATCH: srfsh.c (more on shelling out)

Scott McKellar mck9 at swbell.net
Fri Jul 13 00:32:54 EDT 2007


--- Mike Rylander <mrylander at gmail.com> wrote:

> This is, in fact, the problem.  I've fixed it by using
> calloc()/free()
> instead of using an array.  calloc() has the extra benefit of zeroing
> the memory, so the first memset() is no longer needed.  I left the
> NULLification of the last + 1 pointer in place for systems where NULL
> != all-0-bits.

While your version of the fix should work, I don't know why you
consider it an advantage to zero out memory, when every single zeroed
byte will be either immediately overwritten or forever ignored.  The
first memset() was never needed, or at best was overkill for
nullifying a single pointer.

I would be inclined to leave the pointers in a declared array,
possibly static, or even at file scope.  But if you'd rather
allocate it and free it every time, that will work too.

Scott McKellar
http://home.swbell.net/mck9/ct/



More information about the Open-ils-dev mailing list