From: scottmk Date: Mon, 1 Feb 2010 04:32:48 +0000 (+0000) Subject: Rearrange the error handling a bit in send_request(). The old code X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=47e0deff19be4523e68f1ca60d3e1835d15d6e84;p=working%2FOpenSRF.git Rearrange the error handling a bit in send_request(). The old code looked like it would segfault in the case of a relay command. M src/srfsh/srfsh.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1913 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/srfsh/srfsh.c b/src/srfsh/srfsh.c index 1d394e9..dc1c733 100644 --- a/src/srfsh/srfsh.c +++ b/src/srfsh/srfsh.c @@ -752,6 +752,10 @@ int send_request( const char* server, osrfLogToStderr(); params = jsonParse( OSRF_BUFFER_C_STR( buffer ) ); osrfRestoreLogType(); + if( params == NULL) { + fprintf(stderr, "JSON error detected, not executing\n"); + return 1; + } } } else { if(!last_result || ! last_result->_result_content) { @@ -764,12 +768,6 @@ int send_request( const char* server, } } - if(buffer->n_used > 0 && params == NULL) { - fprintf(stderr, "JSON error detected, not executing\n"); - jsonObjectFree(params); - return 1; - } - int session_is_temporary; // boolean osrfAppSession* session = osrfHashGet( server_hash, server ); if( session ) {