From: miker Date: Thu, 31 Jan 2008 19:23:27 +0000 (+0000) Subject: Patch from Scott McKellar: X-Git-Tag: osrf_rel_2_0_1~728 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=581eb688bd5bb27e0054222432abcf8065f05253;p=OpenSRF.git Patch from Scott McKellar: 1. In osrfSystemBootstrap(): we build an osrfStringArray of children to spawn, and then spawn them. However we didn't free the osrfStringArray afterwards. Now we do. 2. In osrfSystemBootstrapClientResc(): we were potentially leaking the osrfStringArray arr in an early return. I moved the early return to a point before the allocation of the osrfStringArray and a number of other things. Not only does the early return not have to free the osrfStringArray, it also doesn't have to free the other things any more. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1239 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libopensrf/osrf_system.c b/src/libopensrf/osrf_system.c index ca389f3..f7d30ed 100644 --- a/src/libopensrf/osrf_system.c +++ b/src/libopensrf/osrf_system.c @@ -150,6 +150,8 @@ int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) { } } // should we do something if there are no apps? does the wait(NULL) below do that for us? + osrfStringArrayFree(arr); + while(1) { errno = 0; int status; @@ -310,6 +312,12 @@ int osrfSystemBootstrapClientResc( char* config_file, char* contextnode, char* r char* log_file = osrfConfigGetValue( NULL, "/logfile"); + if(!log_file) { + fprintf(stderr, "No log file specified in configuration file %s\n", + config_file); + return -1; + } + char* log_level = osrfConfigGetValue( NULL, "/loglevel" ); osrfStringArray* arr = osrfNewStringArray(8); osrfConfigGetValueList(NULL, arr, "/domains/domain"); @@ -321,19 +329,6 @@ int osrfSystemBootstrapClientResc( char* config_file, char* contextnode, char* r char* facility = osrfConfigGetValue( NULL, "/syslog" ); char* actlog = osrfConfigGetValue( NULL, "/actlog" ); - if(!log_file) { - fprintf(stderr, "No log file specified in configuration file %s\n", - config_file); - free(log_level); - free(username); - free(password); - free(port); - free(unixpath); - free(facility); - free(actlog); - return -1; - } - /* if we're a source-client, tell the logger */ char* isclient = osrfConfigGetValue(NULL, "/client"); if( isclient && !strcasecmp(isclient,"true") )