Patch from Scott McKellar:
1. In setSavepoint(), releaseSavepoint() and rollbackSavepoint()
we were leaking spName.
2. Deep in doCreate() we were passing the return value of
jsonObjectToSimpleString() directly to strcmp(), resulting in a leak.
The strcmp() was inside a complex if condition. which I rearranged so
as to capture the string and free it.
Also: I captured and reused the return value from
jsonObjectGetKeyConst() so as to avoid duplicated calls.
Aso: I reversed the sense of the if condition and swapped the branches,
so that it tests for equality rather than inequality. To my eyes this
arrangement is more readable.
3. doRetrieve() was leaking id.
4. jsonNumberToDBString() was passing the return value of
jsonObjectToSimpleString() directly to atol() and atof(), thereby
leaking the memory. I captured the pointers and freed them.
5. searchFieldTransform() was leaking val.
6. In searchJOIN() we were leaking type and filter_op in the case of
some early returns. I moved the allocations past the early returns
so that we don't allocate them until we need them. I also free them
as soon as we are done with them. As a side benefit, I was able to
avoid allocating filter_op at all in some cases.
I gave similar treatment to table, although that wasn't being leaked.
As a result I could avoid having to free it in the early returns.
A couple of the early returns would leak field or fkey. I plugged
those leaks as well.
I moved the declarations of filter and join_filter to their points
of first use, in the interest of clarity.
7. In buildSELECT(): we were passing the return value of
jsonObjectToSimpleString() directly to osrfHashGet(), thereby leaking
the memory. I captured the pointer and freed it.
8. In doFieldmapperSearch() a do/while loop allocates pkey_val but
in some cases wasn't freeing it.
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8589
dcc99617-32d9-48b4-a31d-
7c20da2025e4