Patch from Scott McKellar:
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Mar 2008 04:34:46 +0000 (04:34 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Mar 2008 04:34:46 +0000 (04:34 +0000)
In oilsAuthGetTimeout() we make three calls to
osrf_settings_host_value_object(), which allocates a jsonObject.
However we were passing the return values directly to another
function, without capturing the pointers for freeing.  As a result
we were leaking the jsonObjects thus allocated.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@8954 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_auth.c

index 1373659..59ff65d 100644 (file)
@@ -210,20 +210,22 @@ static double oilsAuthGetTimeout( const jsonObject* userObj, const char* type, d
 
        if(!_oilsAuthOPACTimeout) { /* Load the default timeouts */
 
-               _oilsAuthOPACTimeout =
-                       jsonObjectGetNumber( 
-                               osrf_settings_host_value_object( 
-                                       "/apps/open-ils.auth/app_settings/default_timeout/opac"));
-
-               _oilsAuthStaffTimeout =
-                       jsonObjectGetNumber( 
-                               osrf_settings_host_value_object( 
-                                       "/apps/open-ils.auth/app_settings/default_timeout/staff" ));
-
-               _oilsAuthOverrideTimeout =
-                       jsonObjectGetNumber( 
-                               osrf_settings_host_value_object( 
-                                       "/apps/open-ils.auth/app_settings/default_timeout/temp" ));
+               jsonObject* value_obj;
+
+               value_obj = osrf_settings_host_value_object(
+                       "/apps/open-ils.auth/app_settings/default_timeout/opac" );
+               _oilsAuthOPACTimeout = jsonObjectGetNumber(value_obj);
+               jsonObjectFree(value_obj);
+
+               value_obj = osrf_settings_host_value_object(
+                       "/apps/open-ils.auth/app_settings/default_timeout/staff" );
+               _oilsAuthStaffTimeout = jsonObjectGetNumber(value_obj);
+               jsonObjectFree(value_obj);
+
+               value_obj = osrf_settings_host_value_object(
+                               "/apps/open-ils.auth/app_settings/default_timeout/temp" );
+               _oilsAuthOverrideTimeout = jsonObjectGetNumber(value_obj);
+               jsonObjectFree(value_obj);
 
 
                osrfLogInfo(OSRF_LOG_MARK, "Set default auth timetouts: opac => %d : staff => %d : temp => %d",