From 0f468403e72a139c364a88dbe284445c0ad1f0d3 Mon Sep 17 00:00:00 2001 From: scottmk Date: Wed, 11 Aug 2010 20:59:25 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@17177 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/oils_sql.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c index d195bfe55..7d404c40b 100644 --- a/Open-ILS/src/c-apps/oils_sql.c +++ b/Open-ILS/src/c-apps/oils_sql.c @@ -753,6 +753,7 @@ int beginTransaction( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); setXactId( ctx ); jsonObject* ret = jsonNewObject( getXactId( ctx ) ); osrfAppRespondComplete( ctx, ret ); @@ -824,6 +825,7 @@ int setSavepoint( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); jsonObject* ret = jsonNewObject( spName ); osrfAppRespondComplete( ctx, ret ); jsonObjectFree( ret ); @@ -894,6 +896,7 @@ int releaseSavepoint( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); jsonObject* ret = jsonNewObject( spName ); osrfAppRespondComplete( ctx, ret ); jsonObjectFree( ret ); @@ -964,6 +967,7 @@ int rollbackSavepoint( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); jsonObject* ret = jsonNewObject( spName ); osrfAppRespondComplete( ctx, ret ); jsonObjectFree( ret ); @@ -1016,6 +1020,7 @@ int commitTransaction( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); jsonObject* ret = jsonNewObject( trans_id ); osrfAppRespondComplete( ctx, ret ); jsonObjectFree( ret ); @@ -1069,6 +1074,7 @@ int rollbackTransaction( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); return -1; } else { + dbi_result_free( result ); jsonObject* ret = jsonNewObject( trans_id ); osrfAppRespondComplete( ctx, ret ); jsonObjectFree( ret ); @@ -2107,6 +2113,7 @@ int doCreate( osrfMethodContext* ctx ) { osrfAppSessionPanic( ctx->session ); rc = -1; } else { + dbi_result_free( result ); char* id = oilsFMGetString( target, pkey ); if( !id ) { @@ -5817,7 +5824,8 @@ int doUpdate( osrfMethodContext* ctx ) { if( !oilsIsDBConnected( dbhandle )) osrfAppSessionPanic( ctx->session ); rc = -1; - } + } else + dbi_result_free( result ); free( id ); osrfAppRespondComplete( ctx, obj ); @@ -5929,7 +5937,8 @@ int doDelete( osrfMethodContext* ctx ) { ); if( !oilsIsDBConnected( writehandle )) osrfAppSessionPanic( ctx->session ); - } + } else + dbi_result_free( result ); free( id ); -- 2.11.0