[open-ils-commits] r13566 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Jul 11 18:22:51 EDT 2009


Author: scottmk
Date: 2009-07-11 18:22:47 -0400 (Sat, 11 Jul 2009)
New Revision: 13566

Modified:
   trunk/Open-ILS/src/c-apps/oils_utils.c
Log:
Plug a couple of memory leaks.


Modified: trunk/Open-ILS/src/c-apps/oils_utils.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_utils.c	2009-07-11 04:44:51 UTC (rev 13565)
+++ trunk/Open-ILS/src/c-apps/oils_utils.c	2009-07-11 22:22:47 UTC (rev 13566)
@@ -79,11 +79,13 @@
 	oilsEvent* evt = NULL;
 
 	if (orgid == -1) {
+		jsonObject* where_clause = jsonParseString( "{\"parent_ou\":null}" );
 		jsonObject* org = oilsUtilsQuickReq(
-            "open-ils.cstore", 
-            "open-ils.cstore.direct.actor.org_unit.search",
-            jsonParseString("{\"parent_ou\":null}")
-        );
+			"open-ils.cstore",
+			"open-ils.cstore.direct.actor.org_unit.search",
+			where_clause
+		);
+		jsonObjectFree( where_clause );
 
         orgid = (int)jsonObjectGetNumber( oilsFMGetObject( org, "id" ) );
 
@@ -155,8 +157,9 @@
 	jsonObject* params = jsonParseStringFmt("{\"barcode\":\"%s\"}", barcode);
 	jsonObject* card = oilsUtilsQuickReq(
 		"open-ils.cstore", "open-ils.cstore.direct.actor.card.search", params );
+	jsonObjectFree(params);
 
-	if(!card) { jsonObjectFree(params); return NULL; }
+	if(!card) return NULL;
 
 	char* usr = oilsFMGetString(card, "usr");
 	jsonObjectFree(card);
@@ -164,7 +167,6 @@
 	double iusr = strtod(usr, NULL);
 	free(usr);
 
-	jsonObjectFree(params);
 	params = jsonParseStringFmt("[%f]", iusr);
 	jsonObject* user = oilsUtilsQuickReq(
 		"open-ils.cstore", "open-ils.cstore.direct.actor.user.retrieve", params);



More information about the open-ils-commits mailing list