fixed some memory logic errors
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 4 Mar 2005 03:24:01 +0000 (03:24 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 4 Mar 2005 03:24:01 +0000 (03:24 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@172 9efc2488-bf62-4759-914b-345cdb29e865

src/libstack/osrf_app_session.c
src/libstack/osrf_message.c

index 06df3da..452f4b1 100644 (file)
@@ -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;
index 9e37572..03bd664 100644 (file)
@@ -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);