Patch from Scott McKellar:
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 31 Jan 2008 19:23:27 +0000 (19:23 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 31 Jan 2008 19:23:27 +0000 (19:23 +0000)
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

src/libopensrf/osrf_system.c

index ca389f3..f7d30ed 100644 (file)
@@ -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?
 
                } 
        } // 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;
        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");
 
 
        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");
        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" );
 
        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") )
        /* if we're a source-client, tell the logger */
        char* isclient = osrfConfigGetValue(NULL, "/client");
        if( isclient && !strcasecmp(isclient,"true") )