Index: trunk/zoo-project/zoo-kernel/service_conf.y
===================================================================
--- trunk/zoo-project/zoo-kernel/service_conf.y	(revision 502)
+++ trunk/zoo-project/zoo-kernel/service_conf.y	(revision 503)
@@ -803,4 +803,5 @@
   if (srin==NULL){
     fprintf(stderr,"error : file not found\n") ;
+    setMapInMaps(conf,"lenv","message","file not found");
     return -1;
   }
@@ -852,5 +853,4 @@
     fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
     setMapInMaps(conf,"lenv","message",srlval.chaine);
-    dumpMaps(conf);
 #ifndef WIN32
     srlex_destroy();
Index: trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal.c	(revision 502)
+++ trunk/zoo-project/zoo-kernel/service_internal.c	(revision 503)
@@ -3097,5 +3097,6 @@
     sprintf(key,"sprefix_%d",i);
     map* tmp00=getMapFromMaps(conf,"lenv",key);
-    sprintf(buffer,"%s/%s",tmp0,tmp00->value);
+    if(tmp00!=NULL)
+      sprintf(buffer,"%s/%s",tmp0,tmp00->value);
     free(tmp0);
     buffer[strlen(buffer)-1]=0;
@@ -3104,14 +3105,16 @@
       if(tmpMap==NULL || strlen(tmpMap->value)==0){
 	char *tmp01=zStrdup(tmp00->value);
-	tmp01[strlen(tmp01)-1]=0;
 	setMapInMaps(conf,"lenv","metapath",tmp01);
 	free(tmp01);
+	tmp01=NULL;
       }
       else{
-	char *value=(char*)malloc((strlen(tmp00->value)+strlen(tmpMap->value)+2)*sizeof(char));
-	sprintf(value,"%s/%s",tmpMap->value,tmp00->value);
-	value[strlen(value)-1]=0;
-	setMapInMaps(conf,"lenv","metapath",value);
-	free(value);
+	if(tmp00!=NULL && tmpMap!=NULL){
+	  char *value=(char*)malloc((strlen(tmp00->value)+strlen(tmpMap->value)+2)*sizeof(char));
+	  sprintf(value,"%s/%s",tmpMap->value,tmp00->value);
+	  setMapInMaps(conf,"lenv","metapath",value);
+	  free(value);
+	  value=NULL;
+	}
       }
     }else{
Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 502)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 503)
@@ -988,22 +988,34 @@
 	while(tmps!=NULL){
 	  int hasVal=-1;
-	  char *corig=strdup(tmps);
+	  char *corig=zStrdup(tmps);
 	  if(strstr(corig,".")!=NULL){
+	    
 	    parseIdentifier(m,conf_dir,corig,buff1);
+	    map* tmpMap=getMapFromMaps(m,"lenv","metapath");
+	    if(tmpMap!=NULL)
+	      addToMap(request_inputs,"metapath",tmpMap->value);
+
 	    s1=(service*)malloc(SERVICE_SIZE);
 	    t=readServiceFile(m,buff1,&s1,corig);
-
 	    if(t<0){
 	      map* tmp00=getMapFromMaps(m,"lenv","message");
 	      char tmp01[1024];
 	      if(tmp00!=NULL)
-		sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
+		sprintf(tmp01,_("Unable to parse the ZCFG file for the following ZOO-Service: %s. Message: %s"),tmps,tmp00->value);
 	      else
-		sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name);
+		sprintf(tmp01,_("Unable to parse the ZCFG file for the following ZOO-Service: %s."),tmps);
 	      dup2(saved_stdout,fileno(stdout));
-	      errorException(m, tmp01,"InternalError",NULL);
+	      errorException(m, tmp01,"InvalidParameterValue","identifier");
 	      freeMaps(&m);
 	      free(m);
 	      free(REQUEST);
+	      free(corig);
+	      free(orig);
+	      free(SERVICE_URL);
+	      free(s1);
+	      closedir(dirp);
+	      xmlFreeDoc(doc);
+	      xmlCleanupParser();
+	      zooXmlCleanupNs();
 	      return 1;
 	    }
@@ -1016,56 +1028,58 @@
 	    s1=NULL;
 	    scount++;
-	    setMapInMaps(m,"lenv","level","0");
-	  }
-	  
-	  memset(buff,0,256);
-	  snprintf(buff,256,"%s.zcfg",corig);
-	  free(corig);
-	  memset(buff1,0,1024);
-#ifdef DEBUG
-	  printf("\n#######%s\n########\n",buff);
-#endif
-	  while ((dp = readdir(dirp)) != NULL){
-	    if( strcasecmp(dp->d_name,buff)==0 ){
-	      memset(buff1,0,1024);
-	      snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
-	      s1=(service*)malloc(SERVICE_SIZE);
-	      if(s1 == NULL){
-		dup2(saved_stdout,fileno(stdout));
-		return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
+	    hasVal=1;
+	  }else{
+	    memset(buff,0,256);
+	    snprintf(buff,256,"%s.zcfg",corig);
+	    free(corig);
+	    memset(buff1,0,1024);
+#ifdef DEBUG
+	    printf("\n#######%s\n########\n",buff);
+#endif
+	    while ((dp = readdir(dirp)) != NULL){
+	      if( strcasecmp(dp->d_name,buff)==0 ){
+		memset(buff1,0,1024);
+		snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
+		s1=(service*)malloc(SERVICE_SIZE);
+		if(s1 == NULL){
+		  dup2(saved_stdout,fileno(stdout));
+		  return errorException(m, _("Unable to allocate memory."),"InternalError",NULL);
+		}
+#ifdef DEBUG
+		printf("#################\n(%s) %s\n#################\n",r_inputs->value,buff1);
+#endif
+		char *tmp0=zStrdup(dp->d_name);
+		tmp0[strlen(tmp0)-5]=0;
+		t=readServiceFile(m,buff1,&s1,tmp0);
+		free(tmp0);
+		if(t<0){
+		  map* tmp00=getMapFromMaps(m,"lenv","message");
+		  char tmp01[1024];
+		  if(tmp00!=NULL)
+		    sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
+		  else
+		    sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name);
+		  dup2(saved_stdout,fileno(stdout));
+		  errorException(m, tmp01,"InternalError",NULL);
+		  freeMaps(&m);
+		  free(m);
+		  free(orig);
+		  free(REQUEST);
+		  closedir(dirp);
+		  xmlFreeDoc(doc);
+		  xmlCleanupParser();
+		  zooXmlCleanupNs();
+		  return 1;
+		}
+#ifdef DEBUG
+		dumpService(s1);
+#endif
+		printDescribeProcessForProcess(m,n,s1);
+		freeService(&s1);
+		free(s1);
+		s1=NULL;
+		scount++;
+		hasVal=1;
 	      }
-#ifdef DEBUG
-	      printf("#################\n(%s) %s\n#################\n",r_inputs->value,buff1);
-#endif
-	      char *tmp0=zStrdup(dp->d_name);
-	      tmp0[strlen(tmp0)-5]=0;
-	      t=readServiceFile(m,buff1,&s1,tmp0);
-	      free(tmp0);
-	      if(t<0){
-		map* tmp00=getMapFromMaps(m,"lenv","message");
-		char tmp01[1024];
-		if(tmp00!=NULL)
-		  sprintf(tmp01,_("Unable to parse the ZCFG file: %s (%s)"),dp->d_name,tmp00->value);
-		else
-		  sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),dp->d_name);
-		dup2(saved_stdout,fileno(stdout));
-		errorException(m, tmp01,"InternalError",NULL);
-		freeMaps(&m);
-		free(m);
-		free(orig);
-		free(REQUEST);
-		closedir(dirp);
-		xmlFreeDoc(doc);
-		return 1;
-	      }
-#ifdef DEBUG
-	      dumpService(s1);
-#endif
-	      printDescribeProcessForProcess(m,n,s1);
-	      freeService(&s1);
-	      free(s1);
-	      s1=NULL;
-	      scount++;
-	      hasVal=1;
 	    }
 	  }
@@ -1078,4 +1092,5 @@
 	      sprintf(tmp01,_("Unable to parse the ZCFG file: %s."),buff);
 	    dup2(saved_stdout,fileno(stdout));
+	    dumpMaps(m);
 	    errorException(m, tmp01,"InvalidParameterValue","Identifier");
 	    freeMaps(&m);
@@ -1085,6 +1100,9 @@
 	    closedir(dirp);
 	    xmlFreeDoc(doc);
+	    xmlCleanupParser();
+	    zooXmlCleanupNs();
 	    return 1;
 	  }
+	  free(corig);
 	  rewinddir(dirp);
 	  tmps=strtok_r(NULL,",",&saveptr);
