[Opensrf-commits] r1239 - trunk/src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jan 31 14:51:06 EST 2008


Author: miker
Date: 2008-01-31 14:23:27 -0500 (Thu, 31 Jan 2008)
New Revision: 1239

Modified:
   trunk/src/libopensrf/osrf_system.c
Log:
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.



Modified: trunk/src/libopensrf/osrf_system.c
===================================================================
--- trunk/src/libopensrf/osrf_system.c	2008-01-31 19:19:47 UTC (rev 1238)
+++ trunk/src/libopensrf/osrf_system.c	2008-01-31 19:23:27 UTC (rev 1239)
@@ -150,6 +150,8 @@
 		} 
 	} // 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 @@
 
 
 	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 @@
 	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") )



More information about the opensrf-commits mailing list