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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Aug 11 16:59:31 EDT 2010


Author: scottmk
Date: 2010-08-11 16:59:25 -0400 (Wed, 11 Aug 2010)
New Revision: 17177

Modified:
   trunk/Open-ILS/src/c-apps/oils_sql.c
Log:
Plug some memory leaks.

In many places we were creating dbi_results without freeing them;
pretty much everything involving transactions, savepoints,
inserts, updates, and deletes.

M    Open-ILS/src/c-apps/oils_sql.c


Modified: trunk/Open-ILS/src/c-apps/oils_sql.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_sql.c	2010-08-11 20:42:07 UTC (rev 17176)
+++ trunk/Open-ILS/src/c-apps/oils_sql.c	2010-08-11 20:59:25 UTC (rev 17177)
@@ -753,6 +753,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		setXactId( ctx );
 		jsonObject* ret = jsonNewObject( getXactId( ctx ) );
 		osrfAppRespondComplete( ctx, ret );
@@ -824,6 +825,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		jsonObject* ret = jsonNewObject( spName );
 		osrfAppRespondComplete( ctx, ret );
 		jsonObjectFree( ret  );
@@ -894,6 +896,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		jsonObject* ret = jsonNewObject( spName );
 		osrfAppRespondComplete( ctx, ret );
 		jsonObjectFree( ret );
@@ -964,6 +967,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		jsonObject* ret = jsonNewObject( spName );
 		osrfAppRespondComplete( ctx, ret );
 		jsonObjectFree( ret );
@@ -1016,6 +1020,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		jsonObject* ret = jsonNewObject( trans_id );
 		osrfAppRespondComplete( ctx, ret );
 		jsonObjectFree( ret );
@@ -1069,6 +1074,7 @@
 			osrfAppSessionPanic( ctx->session );
 		return -1;
 	} else {
+		dbi_result_free( result );
 		jsonObject* ret = jsonNewObject( trans_id );
 		osrfAppRespondComplete( ctx, ret );
 		jsonObjectFree( ret );
@@ -2107,6 +2113,7 @@
 			osrfAppSessionPanic( ctx->session );
 		rc = -1;
 	} else {
+		dbi_result_free( result );
 
 		char* id = oilsFMGetString( target, pkey );
 		if( !id ) {
@@ -5817,7 +5824,8 @@
 		if( !oilsIsDBConnected( dbhandle ))
 			osrfAppSessionPanic( ctx->session );
 		rc = -1;
-	}
+	} else
+		dbi_result_free( result );
 
 	free( id );
 	osrfAppRespondComplete( ctx, obj );
@@ -5929,7 +5937,8 @@
 		);
 		if( !oilsIsDBConnected( writehandle ))
 			osrfAppSessionPanic( ctx->session );
-	}
+	} else
+		dbi_result_free( result );
 
 	free( id );
 



More information about the open-ils-commits mailing list