]> git.evergreen-ils.org Git - Evergreen.git/commit - Open-ILS/include/openils/oils_utils.h
Plug some memory leaks, and eliminate some unnecessary
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 25 May 2010 16:21:56 +0000 (16:21 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 25 May 2010 16:21:56 +0000 (16:21 +0000)
commit93135025e76e0b42e93dba4eadf1023295576059
tree6325c5ef40f6b56fdd5216d8c810641c3c0aa4d4
parent560e4fea22713df23610ee516289439e785bb8ff
Plug some memory leaks, and eliminate some unnecessary
memory allocations.

In oils_utils.[ch]:

-- Create a new function, oilsFMGetStringConst(), similar to
oilsFMGetString() except that it doesn't allocate memory; it returns
a const pointer to a string internal to the specified object.

-- Add some comments, tidy up white space.

In oils_sql.c:

-- Replace oilsFMGetString() with oilsFMGetStringConst in a number
of places; partly to reduce memory churn, and partly to plug some
memory leaks where the function call was nested within a
parameter list.

-- Change org_tree_root() so as to return a const pointer to a
static buffer (which was already in use as a cache) instead of
allocating a copy of the string.  This change reduces memory
churn.  In addition the allocated string was leaking anyway, and
now that leak is plugged.

M    Open-ILS/include/openils/oils_utils.h
M    Open-ILS/src/c-apps/oils_sql.c
M    Open-ILS/src/c-apps/oils_utils.c

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16494 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/include/openils/oils_utils.h
Open-ILS/src/c-apps/oils_sql.c
Open-ILS/src/c-apps/oils_utils.c