From 04b17eaaf86d332f97ad7a5fbd02b9a9c2b4c5c1 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 4 Mar 2005 03:24:01 +0000 Subject: [PATCH] fixed some memory logic errors git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@172 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_app_session.c | 7 +++++-- src/libstack/osrf_message.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libstack/osrf_app_session.c b/src/libstack/osrf_app_session.c index 06df3da..452f4b1 100644 --- a/src/libstack/osrf_app_session.c +++ b/src/libstack/osrf_app_session.c @@ -31,6 +31,7 @@ osrf_app_request* _osrf_app_request_init( /** Frees memory used by an app_request object */ void _osrf_app_request_free( osrf_app_request * req ){ if( req == NULL ) return; + /* osrf_message* cur_msg = req->result; while( cur_msg != NULL ) { osrf_message* next_msg = cur_msg->next; @@ -38,6 +39,7 @@ void _osrf_app_request_free( osrf_app_request * req ){ cur_msg = next_msg; } osrf_message_free( req->payload ); + */ free( req ); } @@ -459,8 +461,9 @@ int osrf_app_session_connect(osrf_app_session* session){ osrf_message* con_msg = osrf_message_init( CONNECT, session->thread_trace, 1 ); osrf_app_session_reset_remote( session ); session->state = OSRF_SESSION_CONNECTING; - if(!_osrf_app_session_send( session, con_msg ) ) - return 0; + int ret = _osrf_app_session_send( session, con_msg ); + osrf_message_free(con_msg); + if(!ret) return 0; time_t start = time(NULL); time_t remaining = (time_t) timeout; diff --git a/src/libstack/osrf_message.c b/src/libstack/osrf_message.c index 9e37572..03bd664 100644 --- a/src/libstack/osrf_message.c +++ b/src/libstack/osrf_message.c @@ -144,7 +144,7 @@ void osrf_message_set_result_content( osrf_message* msg, json* result_content ) void osrf_message_free( osrf_message* msg ) { if( msg == NULL ) - warning_handler( "Trying to delete NULL osrf_message" ); + return; if( msg->status_name != NULL ) free(msg->status_name); -- 2.11.0