Index: trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-kernel/zoo_service_loader.c	(revision 109)
+++ trunk/zoo-kernel/zoo_service_loader.c	(revision 114)
@@ -94,5 +94,5 @@
 }
 
-xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,char* search){
+xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,const char* search){
   xmlXPathContextPtr xpathCtx;
   xmlXPathObjectPtr xpathObj;
@@ -110,5 +110,5 @@
 void sig_handler(int sig){
   char tmp[100];
-  char *ssig;
+  const char *ssig;
   switch(sig){
   case SIGSEGV:
@@ -153,5 +153,5 @@
   map* r_inputs=NULL;
 #ifndef WIN32
-  getcwd(ntmp,1024);
+  char* pntmp=getcwd(ntmp,1024);
 #else
   _getcwd(ntmp,1024);
@@ -360,7 +360,6 @@
 #endif
 
-  map* r_inputs=NULL,*tmps=NULL;
+  map* r_inputs=NULL;
   maps* m=NULL;
-  int argc=count(request_inputs);
 
   char* REQUEST=NULL;
@@ -374,5 +373,5 @@
   char ntmp[1024];
 #ifndef WIN32
-  getcwd(ntmp,1024);
+  char *pntmp=getcwd(ntmp,1024);
 #else
   _getcwd(ntmp,1024);
@@ -470,5 +469,4 @@
   }
 
-  map* outputs=NULL;
   maps* request_output_real_format=NULL;
   map* tmpm=getMapFromMaps(m,"main","serverAddress");
@@ -478,5 +476,4 @@
     SERVICE_URL=strdup(DEFAULT_SERVICE_URL);
 
-  service* s[100];
   service* s1;
   int scount=0;
@@ -497,5 +494,4 @@
 
   if(strncasecmp(REQUEST,"GetCapabilities",15)==0){
-    int i=0;
     struct dirent *dp;
 #ifdef DEBUG
@@ -510,5 +506,4 @@
     r_inputs=getMap(request_inputs,"ServiceProvider");
     xmlNodePtr n;
-    //dumpMap(request_inputs);
     if(r_inputs!=NULL)
       n = printGetCapabilitiesHeader(doc,r_inputs->value,m);
@@ -595,7 +590,4 @@
       char buff[256];
       char buff1[1024];
-      int i=0;
-      int j=0;
-      int end=-1;
       int saved_stdout = dup(fileno(stdout));
       dup2(fileno(stderr),fileno(stdout));
@@ -611,5 +603,4 @@
 	    memset(buff1,0,1024);
 	    snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
-	    //s1=(service*)malloc(sizeof(service*));
 	    s1=(service*)calloc(1,SERVICE_SIZE);
 	    if(s1 == NULL){
@@ -640,5 +631,4 @@
       free(SERVICE_URL);
       fflush(stdout);
-      //xmlFree(n);
 #ifndef LINUX_FREE_ISSUE
       if(s1)
@@ -654,5 +644,4 @@
 #endif	
 	closedir(dirp);
-	free(s);
 	return 0;
       }
@@ -703,6 +692,4 @@
   dumpService(s1);
 #endif
-  map* inputs=NULL;
-  elements* c_inputs=s1->inputs;
   int j;
   
@@ -747,5 +734,4 @@
       fprintf(stderr,"OUTPUT Parsing start now ... \n");
 #endif
-      char current_output_as_string[10240];
       char cursor_output[10240];
       char *cotmp=strdup(r_inputs->value);
@@ -753,5 +739,4 @@
       free(cotmp);
       j=0;
-      map* request_kvp_outputs=NULL;
 	
       /**
@@ -834,5 +819,4 @@
 	fflush(stderr);
 #endif
-	//tmp_output=tmp_output->next;
 	free(tmp);
       }
@@ -848,5 +832,4 @@
     fprintf(stderr,"DATA INPUTS [%s]\n",r_inputs->value);
 #endif
-    char current_input_as_string[40960];
     char cursor_input[40960];
     if(r_inputs!=NULL)
@@ -864,5 +847,4 @@
     }
     j=0;
-    map* request_kvp_inputs=NULL;
   
     /**
@@ -907,5 +889,4 @@
 	strncpy(tmpn,tmpc,(strlen(tmpc)-strlen(tmpv))*sizeof(char));
 	tmpn[strlen(tmpc)-strlen(tmpv)]=0;
-	int cnt=0;
 #ifdef DEBUG
 	fprintf(stderr,"***\n*** %s = %s ***\n",tmpn,tmpv+1);
@@ -1010,9 +991,7 @@
     fflush(stderr);
 #endif
-    xmlNodePtr cur = xmlDocGetRootElement(doc);
     /**
      * Parse every Input in DataInputs node.
      */
-    maps* tempMaps=NULL;
     xmlXPathObjectPtr tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='Input']");
     xmlNodeSet* tmps=tmpsptr->nodesetval;
@@ -1064,5 +1043,5 @@
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
 	      }
-	      tmpmaps->name="missingIndetifier";
+	      tmpmaps->name=strdup("missingIndetifier");
 	      tmpmaps->content=createMap((char*)cur2->name,(char*)val);
 	      tmpmaps->next=NULL;
@@ -1093,6 +1072,5 @@
 	    fprintf(stderr,"REFERENCE\n");
 #endif
-	    map* referenceMap=NULL;
-	    char *refs[5];
+	    const char *refs[5];
 	    refs[0]="mimeType";
 	    refs[1]="encoding";
@@ -1100,5 +1078,4 @@
 	    refs[3]="method";
 	    refs[4]="href";
-	    char*url;
 	    for(int l=0;l<5;l++){
 #ifdef DEBUG
@@ -1142,7 +1119,5 @@
 	    while(cur3){
 	      if(xmlStrcasecmp(cur3->name,BAD_CAST "Header")==0 ){
-		xmlNodePtr cur4=cur3;
-		char *tmp=new char[cgiContentLength];
-		char *ha[2];
+		const char *ha[2];
 		ha[0]="key";
 		ha[1]="value";
@@ -1170,5 +1145,5 @@
 		}
 		hInternet.header=curl_slist_append(hInternet.header, has);
-		//free(has);
+		free(has);
 	      }
 	      else{
@@ -1302,17 +1277,17 @@
 		 * dataType , uom
 		 */
-		char *lits[2];
-		lits[0]="dataType";
-		lits[1]="uom";
+		char *list[2];
+		list[0]=strdup("dataType");
+		list[1]=strdup("uom");
 		for(int l=0;l<2;l++){
 #ifdef DEBUG
-		  fprintf(stderr,"*** LiteralData %s ***",lits[l]);
-#endif
-		  xmlChar *val=xmlGetProp(cur4,BAD_CAST lits[l]);
+		  fprintf(stderr,"*** LiteralData %s ***",list[l]);
+#endif
+		  xmlChar *val=xmlGetProp(cur4,BAD_CAST list[l]);
 		  if(val!=NULL && strlen((char*)val)>0){
 		    if(tmpmaps->content!=NULL)
-		      addToMap(tmpmaps->content,lits[l],(char*)val);
+		      addToMap(tmpmaps->content,list[l],(char*)val);
 		    else
-		      tmpmaps->content=createMap(lits[l],(char*)val);
+		      tmpmaps->content=createMap(list[l],(char*)val);
 		  }
 #ifdef DEBUG
@@ -1320,4 +1295,5 @@
 #endif
 		  xmlFree(val);
+		  free(list[l]);
 		}
 	      }
@@ -1327,5 +1303,5 @@
 		 * mimeType, encoding, schema
 		 */
-		char *coms[3];
+		const char *coms[3];
 		coms[0]="mimeType";
 		coms[1]="encoding";
@@ -1368,5 +1344,4 @@
 		char *res=NULL;
 		char *curs=tmpv->value;
-		int i=0;
 		for(int i=0;i<=strlen(tmpv->value)/64;i++) {
 		  if(res==NULL)
@@ -1421,5 +1396,4 @@
 #endif
     xmlXPathFreeObject(tmpsptr);
-    //xmlFree(tmps);
     
     tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='ResponseDocument']");
@@ -1439,5 +1413,4 @@
       else
 	addToMap(request_inputs,"ResponseDocument","");
-      request_output_real_format;
       maps *tmpmaps=NULL;
       xmlNodePtr cur=tmps->nodeTab[k];
@@ -1451,5 +1424,5 @@
 	    return errorException(m, _("Unable to allocate memory."), "InternalError");
 	  }
-	  tmpmaps->name="unknownIdentifier";
+	  tmpmaps->name=strdup("unknownIdentifier");
 	  tmpmaps->next=NULL;
 	}
@@ -1458,5 +1431,5 @@
 	 * storeExecuteResponse, lineage, status
 	 */
-	char *ress[3];
+	const char *ress[3];
 	ress[0]="storeExecuteResponse";
 	ress[1]="lineage";
@@ -1487,5 +1460,5 @@
 	     * mimeType, encoding, schema, uom, asReference
 	     */
-	    char *outs[5];
+	    const char *outs[5];
 	    outs[0]="mimeType";
 	    outs[1]="encoding";
@@ -1543,5 +1516,5 @@
 		    return errorException(m, _("Unable to allocate memory."), "InternalError");
 		  }
-		  tmpmaps->name="missingIndetifier";
+		  tmpmaps->name=strdup("missingIndetifier");
 		  tmpmaps->content=createMap((char*)cur2->name,(char*)val);
 		  tmpmaps->next=NULL;
@@ -1563,5 +1536,4 @@
 	}
       }
-      //xmlFree(cur);
       if(request_output_real_format==NULL)
 	request_output_real_format=dupMaps(&tmpmaps);
@@ -1576,5 +1548,4 @@
 
     xmlXPathFreeObject(tmpsptr);
-    //xmlFree(tmps);
     xmlCleanupParser();
   }
