Index: /trunk/zoo-project/zoo-kernel/zoo_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_loader.c	(revision 380)
+++ /trunk/zoo-project/zoo-kernel/zoo_loader.c	(revision 381)
@@ -83,5 +83,8 @@
 #endif
 
-  char *strQuery=strdup(cgiQueryString);
+  
+  char *strQuery=NULL;
+  if(cgiQueryString!=NULL)
+    strQuery=strdup(cgiQueryString);
   map* tmpMap=NULL;
 
@@ -93,5 +96,5 @@
        char *res=NULL;
        int r=0;
-       while(r=fread(buffer,sizeof(char),1,cgiIn)){
+       while((r=fread(buffer,sizeof(char),1,cgiIn))){
 	 cgiContentLength+=r;
 	 if(res==NULL){
@@ -115,5 +118,5 @@
       char *buffer=new char[cgiContentLength+1];
       int r=0;
-      if((r=fread(buffer,sizeof(char),cgiContentLength,cgiIn))!=0){
+      if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>=0){
 	buffer[cgiContentLength]=0;
 	tmpMap=createMap("request",buffer);
@@ -196,5 +199,4 @@
       xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength);
 
-
       {
 	xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*");
@@ -244,5 +246,4 @@
 	  xmlXPathFreeObject(reqptr);
 	}
-	//xmlFree(req);
       }
       if(strncasecmp(t1->value,"GetCapabilities",15)==0){
@@ -252,5 +253,4 @@
 	addToMap(tmpMap,"version",(char*)content);
 	xmlXPathFreeObject(versptr);
-	//xmlFree(vers);
 	xmlFree(content);
       }else{
@@ -259,5 +259,4 @@
 	if(tval!=NULL)
 	  addToMap(tmpMap,"version",tval);
-	xmlFree(tval);
 	tval = (char*) xmlGetProp(cur,BAD_CAST "language");
 	if(tval!=NULL)
@@ -287,7 +286,5 @@
 	  }
 	}
-	//xmlFree(id);
-      }
-      xmlFree(tval);
+      }
       xmlFreeDoc(doc);
       xmlCleanupParser();
@@ -329,4 +326,6 @@
   }
 
+  if(strQuery!=NULL)
+    free(strQuery);
   runRequest(tmpMap);
 
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 380)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 381)
@@ -522,5 +522,5 @@
    * Parsing service specfic configuration file
    */
-  m=(maps*)calloc(1,MAPS_SIZE);
+  m=(maps*)malloc(MAPS_SIZE);
   if(m == NULL){
     return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -533,4 +533,5 @@
 #endif
   r_inputs=getMapOrFill(request_inputs,"metapath","");
+
 
   char conf_file[10240];
@@ -551,4 +552,5 @@
     bindtextdomain ("zoo-services","/usr/share/locale/");
   }
+
 
   /**
@@ -597,4 +599,5 @@
   else
     setMapInMaps(m,"main","isSoap","false");
+
 
   /**
@@ -698,5 +701,5 @@
 	memset(tmps1,0,1024);
 	snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name);
-	s1=(service*)calloc(1,SERVICE_SIZE);
+	s1=(service*)malloc(SERVICE_SIZE);
 	if(s1 == NULL){ 
 	  return errorException(m, _("Unable to allocate memory."),"InternalError");
@@ -782,5 +785,5 @@
 	    memset(buff1,0,1024);
 	    snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
-	    s1=(service*)calloc(1,SERVICE_SIZE);
+	    s1=(service*)malloc(SERVICE_SIZE);
 	    if(s1 == NULL){
 	      dup2(saved_stdout,fileno(stdout));
@@ -830,5 +833,5 @@
   
   s1=NULL;
-  s1=(service*)calloc(1,SERVICE_SIZE);
+  s1=(service*)malloc(SERVICE_SIZE);
   if(s1 == NULL){
     freeMaps(&m);
@@ -876,4 +879,5 @@
   int j;
   
+
   /**
    * Create the input and output maps data structure
@@ -931,5 +935,5 @@
 #endif
       pToken=strtok(cursor_output,";");
-      char** outputs_as_text=(char**)calloc(128,sizeof(char*));
+      char** outputs_as_text=(char**)malloc(128*sizeof(char*));
       if(outputs_as_text == NULL) {
 	return errorException(m, _("Unable to allocate memory"), "InternalError");
@@ -942,5 +946,5 @@
 	fprintf(stderr,"***%s***\n",pToken);
 #endif
-	outputs_as_text[i]=(char*)calloc(strlen(pToken)+1,sizeof(char));
+	outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
 	if(outputs_as_text[i] == NULL) {
 	  return errorException(m, _("Unable to allocate memory"), "InternalError");
@@ -959,5 +963,5 @@
 	  if(k==0){
 	    if(tmp_output==NULL){
-	      tmp_output=(maps*)calloc(1,MAPS_SIZE);
+	      tmp_output=(maps*)malloc(MAPS_SIZE);
 	      if(tmp_output == NULL){
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1044,5 +1048,5 @@
     free(tmp1);
 
-    char** inputs_as_text=(char**)calloc(100,sizeof(char*));
+    char** inputs_as_text=(char**)malloc(100*sizeof(char*));
     if(inputs_as_text == NULL){
       return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1057,5 +1061,5 @@
       fprintf(stderr,"***%s***\n",pToken);
 #endif
-      inputs_as_text[i]=(char*)calloc(strlen(pToken)+1,sizeof(char));
+      inputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char));
       snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken);
       if(inputs_as_text[i] == NULL){
@@ -1090,5 +1094,5 @@
 #endif
 	if(tmpmaps==NULL){
-	  tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	  tmpmaps=(maps*)malloc(MAPS_SIZE);
 	  if(tmpmaps == NULL){
 	    return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1124,5 +1128,5 @@
 	    tmpn1[strlen(tmpc)]=0;
 	    map* lmap=getLastMap(tmpmaps->content);
-	    char *tmpValue=(char*)calloc((strlen(tmpv)+strlen(tmpc)+1),sizeof(char));
+	    char *tmpValue=(char*)malloc((strlen(tmpv)+strlen(tmpc)+1)*sizeof(char));
 	    sprintf(tmpValue,"%s@%s",tmpv+1,tmpc);
 	    free(lmap->value);
@@ -1260,5 +1264,5 @@
 	    xmlChar *val= xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
 	    if(tmpmaps==NULL){
-	      tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	      tmpmaps=(maps*)malloc(MAPS_SIZE);
 	      if(tmpmaps == NULL){
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1278,5 +1282,5 @@
 	      xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
 	    if(tmpmaps==NULL){
-	      tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	      tmpmaps=(maps*)malloc(MAPS_SIZE);
 	      if(tmpmaps == NULL){
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1365,8 +1369,8 @@
 #endif
 		  if(hai==0){
-		    key=(char*)calloc((1+strlen((char*)val)),sizeof(char));
+		    key=(char*)malloc((1+strlen((char*)val))*sizeof(char));
 		    snprintf(key,1+strlen((char*)val),"%s",(char*)val);
 		  }else{
-		    has=(char*)calloc((3+strlen((char*)val)+strlen(key)),sizeof(char));
+		    has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char));
 		    if(has == NULL){
 		      return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1417,5 +1421,5 @@
 		    res=InternetOpenUrl(hInternet,btmp->value,tmp,strlen(tmp),
 					INTERNET_FLAG_NO_CACHE_WRITE,0);
-		    char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char));
+		    char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
 		    if(tmpContent == NULL){
 		      return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1452,5 +1456,5 @@
 					 INTERNET_FLAG_NO_CACHE_WRITE,0);
 		    char* tmp=
-		      (char*)calloc((res1.nDataLen+1),sizeof(char));
+		      (char*)malloc((res1.nDataLen+1)*sizeof(char));
 		    if(tmp == NULL){
 		      return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1470,5 +1474,5 @@
 					  strlen(tmp),
 					  INTERNET_FLAG_NO_CACHE_WRITE,0);
-		      char* tmpContent = (char*)calloc((res.nDataLen+1),sizeof(char));
+		      char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char));
 		      if(tmpContent == NULL){
 			return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1688,9 +1692,10 @@
 	 */
 	if(tmpmaps==NULL){
-	  tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	  tmpmaps=(maps*)malloc(MAPS_SIZE);
 	  if(tmpmaps == NULL){
 	    return errorException(m, _("Unable to allocate memory."), "InternalError");
 	  }
 	  tmpmaps->name=strdup("unknownIdentifier");
+	  tmpmaps->content=NULL;
 	  tmpmaps->next=NULL;
 	}
@@ -1719,4 +1724,6 @@
 	}
 	xmlNodePtr cur1=cur->children;
+	while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE)
+	  cur1=cur1->next;
 	while(cur1){
 	  /**
@@ -1727,5 +1734,5 @@
 	      xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
 	    if(tmpmaps==NULL){
-	      tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	      tmpmaps=(maps*)malloc(MAPS_SIZE);
 	      if(tmpmaps == NULL){
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1747,5 +1754,5 @@
 	      xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
 	    if(tmpmaps==NULL){
-	      tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+	      tmpmaps=(maps*)malloc(MAPS_SIZE);
 	      if(tmpmaps == NULL){
 		return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1787,5 +1794,4 @@
 	      xmlFree(val);
 	    }
-	    
 	    xmlNodePtr cur2=cur1->children;
 	    while(cur2){
@@ -1797,5 +1803,5 @@
 		  xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
 		if(tmpmaps==NULL){
-		  tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+		  tmpmaps=(maps*)malloc(MAPS_SIZE);
 		  if(tmpmaps == NULL){
 		    return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1820,5 +1826,5 @@
 		  xmlNodeListGetString(doc,cur2->xmlChildrenNode,1);
 		if(tmpmaps==NULL){
-		  tmpmaps=(maps*)calloc(1,MAPS_SIZE);
+		  tmpmaps=(maps*)malloc(MAPS_SIZE);
 		  if(tmpmaps == NULL){
 		    return errorException(m, _("Unable to allocate memory."), "InternalError");
@@ -1858,5 +1864,4 @@
       }
     }
-
     xmlXPathFreeObject(tmpsptr);
     xmlCleanupParser();
@@ -2096,5 +2101,5 @@
       sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(cgiCookie,"=")+1);
     free(tcook);
-    maps *tmpSess=(maps*)calloc(1,MAPS_SIZE);
+    maps *tmpSess=(maps*)malloc(MAPS_SIZE);
     struct stat file_status;
     int istat = stat(session_file_path, &file_status);
