[Opensrf-commits] r1238 - trunk/src/gateway

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jan 31 14:47:26 EST 2008


Author: miker
Date: 2008-01-31 14:19:47 -0500 (Thu, 31 Jan 2008)
New Revision: 1238

Modified:
   trunk/src/gateway/osrf_json_gateway.c
Log:
Patch from Scott McKellar:

1. In osrf_json_gateway_method_handler(): we were leaking the
jsonObject arr.

2. Also in osrf_json_gateway_method_handler(): we were leaking session
in the case of an early exit.

3. Replaced identifiers:

   osrf_app_client_session_init   ==> osrfAppSessionClientInit
   osrf_app_session               ==> osrfAppSession (struct)
   osrf_message                   ==> osrfMessage
   osrf_message_free              ==> osrfMessageFree
   string_array                   ==> osrfStringArray
   string_array_destroy           ==> osrfStringArrayFree



Modified: trunk/src/gateway/osrf_json_gateway.c
===================================================================
--- trunk/src/gateway/osrf_json_gateway.c	2008-01-31 19:12:40 UTC (rev 1237)
+++ trunk/src/gateway/osrf_json_gateway.c	2008-01-31 19:19:47 UTC (rev 1238)
@@ -161,8 +161,8 @@
 	r->allowed |= (AP_METHOD_BIT << M_POST);
 
 	osrfLogDebug(OSRF_LOG_MARK, "osrf gateway: parsing URL params");
-	string_array* mparams	= NULL;
-	string_array* params	= apacheParseParms(r); /* free me */
+	osrfStringArray* mparams	= NULL;
+	osrfStringArray* params	= apacheParseParms(r); /* free me */
 	param_locale		= apacheGetFirstParamValue( params, "locale" );
 	service			= apacheGetFirstParamValue( params, "service" );
 	method			= apacheGetFirstParamValue( params, "method" ); 
@@ -252,7 +252,7 @@
 		fflush(stderr);
 		*/
 
-		osrfAppSession* session = osrf_app_client_session_init(service);
+		osrfAppSession* session = osrfAppSessionClientInit(service);
 		osrf_app_session_set_locale(session, osrf_locale);
 
 		double starttime = get_timestamp_millis();
@@ -268,6 +268,7 @@
 				jsonObjectPush(arr, parseJSONFunc(str));
 
 			req_id = osrfAppSessionMakeRequest( session, arr, method, api_level, NULL );
+			jsonObjectFree(arr);
 		} else {
 
 			/**
@@ -290,6 +291,7 @@
 
 		if( req_id == -1 ) {
 			osrfLogError(OSRF_LOG_MARK, "I am unable to communicate with opensrf..going away...");
+			osrfAppSessionFree(session);
 			/* we don't want to spawn an intense re-forking storm 
 			 * if there is no jabber server.. so give it some time before we die */
 			usleep( 100000 ); /* 100 milliseconds */
@@ -319,7 +321,7 @@
 		/* ----------------------------------------------------------------- */
 
 
-		osrf_message* omsg = NULL;
+		osrfMessage* omsg = NULL;
 
 		int statuscode = 200;
 
@@ -360,7 +362,7 @@
 				}
 			}
 	
-			osrf_message_free(omsg);
+			osrfMessageFree(omsg);
 			if(statusname) break;
 		}
 
@@ -419,8 +421,8 @@
 	}
 
 	osrfLogInfo(OSRF_LOG_MARK, "Completed processing service=%s, method=%s", service, method);
-	string_array_destroy(params);
-	string_array_destroy(mparams);
+	osrfStringArrayFree(params);
+	osrfStringArrayFree(mparams);
 	free( osrf_locale );
 	free( input_format );
 	free( method );



More information about the opensrf-commits mailing list