]> git.evergreen-ils.org Git - Evergreen.git/commit
Patch from Scott McKellar which plugs a couple of memory leaks, and
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Feb 2008 12:52:04 +0000 (12:52 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Feb 2008 12:52:04 +0000 (12:52 +0000)
commit00d63643433873a628affd1fdbad4fcb57b91319
treed949b1f258b0c97656b1437324ccc6be1b378a3b
parent4e3c634c9ac5f3dfe600f9a6d4bdc08c0600f60b
Patch from Scott McKellar which plugs a couple of memory leaks, and
applies some minor optimizations, as much for clarity as for
performance.

1. In buildSELECT() we were leaking defaultselhash in the case of an
early return.

2. In doFieldmapperSearch() we were leaking flesh_blob in the case
of an early return.

3. In doFieldmapperSearch() I rearranged the logic a bit.  First,
I performed a single search of meta to get a method type and saved
the result for reuse, instead of performing the identical search
repeatedly.  Second, I turned a series of ifs into a series of
if/elses.  That way we stop searching when we find a match.  More
importantly, the if/else structure makes it more clear to the reader
that we're really just branching on method type in a case structure.

This latter change requires that none of the branches changes the
contents of ctx->method->userData.  So far as I can tell by tracing
out all the branches, this condition is satisfied, as one would
intuitively expect.

4. Also in doFieldmapperSearch(): I increased the size of the
growing_buffer sel_list from 16 characters to 64.  Since the
formatted string is at least 13 characters long, depending on the
length of the class name and primary key, I suspect that 16
characters will almost never be big enough.  Even 64 characters
might be too short.  I don't know how long the values typically
are in practice.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@8708 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/src/c-apps/oils_cstore.c