Index: /trunk/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-kernel/service.h	(revision 58)
+++ /trunk/zoo-kernel/service.h	(revision 59)
@@ -418,6 +418,20 @@
       res->next=NULL;
       map* mc=_cursor->content;
+      map* tmp=getMap(mc,"size");
+      char* tmpSized=NULL;
+      if(tmp!=NULL){
+	map* tmpV=getMap(mc,"value");
+	tmpSized=(char*)malloc((atoi(tmp->value)+1)*sizeof(char));
+	memmove(tmpSized,tmpV->value,atoi(tmp->value)*sizeof(char));
+      }
       if(mc!=NULL){
 	addMapToMap(&res->content,mc);
+      }
+      if(tmp!=NULL){
+	map* tmpV=getMap(res->content,"value");
+	free(tmpV->value);
+	tmpV->value=(char*)malloc(atoi(tmp->value)*sizeof(char));
+	memmove(tmpV->value,tmpSized,atoi(tmp->value)*sizeof(char));
+	free(tmpSized);
       }
       res->next=dupMaps(&_cursor->next);
Index: /trunk/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-kernel/service_internal.c	(revision 58)
+++ /trunk/zoo-kernel/service_internal.c	(revision 59)
@@ -1105,4 +1105,6 @@
       addToMap(errorMap,"text",_("No more information available"));
     nc3=createExceptionReportNode(m,errorMap,0);
+    freeMap(&errorMap);
+    free(errorMap);
     xmlAddChild(nc1,nc3);
     break;
@@ -1327,10 +1329,16 @@
 			  || strncmp(tmp2->value,"application/",6)==0)) ){
       map* rs=getMap(m->content,"size");
+      bool isSized=true;
       if(rs==NULL){
 	char tmp1[1024];
 	sprintf(tmp1,"%d",strlen(toto->value));
 	rs=createMap("z",tmp1);
+	isSized=false;
       }
       xmlAddChild(nc3,xmlNewText(BAD_CAST base64((const unsigned char*)toto->value,atoi(rs->value))));
+      if(!isSized){
+	freeMap(&rs);
+	free(rs);
+      }
     }
     else if(tmp!=NULL){
@@ -1646,8 +1654,4 @@
   while(tmpInputs!=NULL){
     maps *tmpMaps=getMaps(out1,tmpInputs->name);
-    /*fprintf(stderr,"IN LOOP\n");
-    dumpElements(tmpInputs);
-    dumpMaps(tmpMaps);
-    fprintf(stderr,"/ IN LOOP\n");*/
     if(tmpMaps==NULL){
       map* tmpMap1=getMap(tmpInputs->content,"minOccurs");
Index: /trunk/zoo-kernel/service_internal_java.c
===================================================================
--- /trunk/zoo-kernel/service_internal_java.c	(revision 58)
+++ /trunk/zoo-kernel/service_internal_java.c	(revision 59)
@@ -62,5 +62,6 @@
   options[1].optionString = "-Djava.compiler=NONE";
 
-  vm_args.version = JNI_VERSION_1_4;
+  vm_args.version = JNI_VERSION_1_2;
+  JNI_GetDefaultJavaVMInitArgs(&vm_args);
   vm_args.options = options;
   vm_args.nOptions = 2;
@@ -284,17 +285,19 @@
       jobject jv=(*env)->CallObjectMethod(env,tmp1,getValue_mid);
 
-#ifdef DEBUG
       jstring jkd=(*env)->GetStringUTFChars(env, jk, NULL);
       jstring jvd=(*env)->GetStringUTFChars(env, jv, NULL);
+
+#ifdef DEBUG
       fprintf(stderr,"%s %s\n",jkd,jvd);
 #endif
 
       if(res==NULL){
-	res=createMap((*env)->GetStringUTFChars(env, jk, NULL),
-		      (*env)->GetStringUTFChars(env, jv, NULL));
+	res=createMap(jkd,jvd);
       }else{
-	addToMap(res,(*env)->GetStringUTFChars(env, jk, NULL),
-		 (*env)->GetStringUTFChars(env, jv, NULL));
+	addToMap(res,jkd,jvd);
       }
+      (*env)->ReleaseStringChars(env, jk, jkd);
+      (*env)->ReleaseStringChars(env, jv, jvd);
+
     }
     jobject jk=(*env)->CallObjectMethod(env,tmp,getKey_mid);
Index: /trunk/zoo-kernel/service_internal_python.c
===================================================================
--- /trunk/zoo-kernel/service_internal_python.c	(revision 58)
+++ /trunk/zoo-kernel/service_internal_python.c	(revision 59)
@@ -106,6 +106,6 @@
 	freeMaps(real_outputs);
 	free(*real_outputs);
-	//*real_inputs=mapsFromPyDict(arg2);
-	//createMapsFromPyDict(real_outputs,arg3);
+	freeMaps(main_conf);
+	free(*main_conf);
 	*main_conf=mapsFromPyDict(arg1);
 	*real_outputs=mapsFromPyDict(arg3);
@@ -134,6 +134,9 @@
 	trace=NULL;
 	trace=PyObject_Str(ptype);
-	if(PyString_Check(trace))
-	  sprintf(pbt,"%s\nTRACE : %s",strdup(pbt),PyString_AsString(trace));
+	if(PyString_Check(trace)){
+	  char *tpbt=strdup(pbt);
+	  sprintf(pbt,"%s\nTRACE : %s",tpbt,PyString_AsString(trace));
+	  free(tpbt);
+	}
 	else
 	  fprintf(stderr,"EMPTY TRACE ?");
@@ -148,13 +151,20 @@
 	trace=PyObject_Str(pValue);
 	if(PyString_Check(trace))
-	  sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",strdup(pbt),PyString_AsString(trace));
+	  sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",pbt,PyString_AsString(trace));
 	else
-	  sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations.",strdup(pbt));
+	  sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations.",pbt);
 	map* err=createMap("text",pbt);
 	addToMap(err,"code","NoApplicableCode");
 	printExceptionReportResponse(m,err);
+	Py_DECREF(arg1);
+	Py_DECREF(arg2);
+	Py_DECREF(arg3);
 	Py_XDECREF(pFunc);
       	Py_DECREF(pArgs);
 	Py_DECREF(pModule);
+	Py_DECREF(ptraceback);
+	Py_DECREF(ptype);
+	Py_DECREF(pValue);
+	Py_Finalize();
 	exit(-1);
       }
@@ -178,8 +188,5 @@
     exit(-1);
   } 
-#ifndef DEBUG
-  // Failed when DEBUG is defined
   Py_Finalize();
-#endif
   return res;
 }
@@ -189,8 +196,10 @@
   maps* tmp=t;
   while(tmp!=NULL){
-    if(PyDict_SetItem(res,PyString_FromString(tmp->name),(PyObject*)PyDict_FromMap(tmp->content))<0){
+    PyObject* subc=PyDict_FromMap(tmp->content);
+    if(PyDict_SetItem(res,PyString_FromString(tmp->name),subc)<0){
       fprintf(stderr,"Unable to parse params...");
       exit(1);
     }
+    Py_DECREF(subc);
     tmp=tmp->next;
   }  
@@ -202,25 +211,33 @@
   map* tmp=t;
   map* size=getMap(tmp,"size");
-  dumpMap(t);
   while(tmp!=NULL){
-    fprintf(stderr,"%s => %s\n"),tmp->name,tmp->value;
+    PyObject* name=PyString_FromString(tmp->name);
     if(strcasecmp(tmp->name,"value")==0){
       if(size!=NULL){
-	if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromStringAndSize(tmp->value,(Py_ssize_t) atoi(size->value)))<0){
+	PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value));
+	if(PyDict_SetItem(res,name,value)<0){
 	  fprintf(stderr,"Unable to parse params...");
 	  exit(1);
 	}
+	Py_DECREF(value);
       }
-      else
-	if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromString(tmp->value))<0){
+      else{
+	PyObject* value=PyString_FromString(tmp->value);
+	if(PyDict_SetItem(res,name,value)<0){
 	  fprintf(stderr,"Unable to parse params...");
 	  exit(1);
 	}
-    } 
-    else
-      if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromString(tmp->value))<0){
+	Py_DECREF(value);
+      }
+    }
+    else{
+      PyObject* value=PyString_FromString(tmp->value);
+      if(PyDict_SetItem(res,name,value)<0){
 	fprintf(stderr,"Unable to parse params...");
 	exit(1);
       }
+      Py_DECREF(value);
+    }
+    Py_DECREF(name);
     tmp=tmp->next;
   }
@@ -244,7 +261,4 @@
 	    PyString_AsString(key),PyString_AsString(value));
 #endif
-    while(cursor!=NULL){
-      cursor=cursor->next;
-    }
     cursor=(maps*)malloc(MAPS_SIZE);
     cursor->name=PyString_AsString(key);
@@ -255,7 +269,10 @@
     cursor->next=NULL;
     if(res==NULL)
-      res=cursor;
+      res=dupMaps(&cursor);
     else
       addMapsToMaps(&res,cursor);
+    freeMap(&cursor->content);
+    free(cursor->content);
+    free(cursor);
 #ifdef DEBUG
     dumpMaps(res);
@@ -263,4 +280,5 @@
 #endif
   }
+  Py_DECREF(list);
   return res;
 }
Index: /trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-kernel/zoo_service_loader.c	(revision 58)
+++ /trunk/zoo-kernel/zoo_service_loader.c	(revision 59)
@@ -954,17 +954,13 @@
 		map* tmpMap=getMap(tmpmaps->content,"value");
 		if(tmpMap!=NULL){
+		  free(tmpMap->value);
 		  tmpMap->value=(char*)malloc((res.nDataLen+1)*sizeof(char));
 		  memmove(tmpMap->value,tmpContent,(res.nDataLen)*sizeof(char));
 		  tmpMap->value[res.nDataLen]=0;
-		  fprintf(stderr,"%d = %d ?\n",res.nDataLen/sizeof(char),strlen(tmpContent));
-		  if(strlen(tmpContent)!=res.nDataLen/sizeof(char)){
+		  if(strlen(tmpContent)!=res.nDataLen){
 		    char tmp[256];
-		    sprintf(tmp,"%d",res.nDataLen);
+		    sprintf(tmp,"%d",res.nDataLen*sizeof(char));
 		    addToMap(tmpmaps->content,"size",tmp);
 		  }
-		  /*FILE* fd=fopen("/tmp/test.png","w");
-		  fwrite(tmpContent,1,(res.nDataLen)*sizeof(char),fd);
-		  fclose(fd);
-		  dumpMap(tmpMap);*/
 		}
 		free(tmpContent);
@@ -982,10 +978,6 @@
 	else
 	  addMapsToMaps(&request_input_real_format,tmpmaps);
-	/*freeMap(&tmpmaps->content);
-	free(tmpmaps->content);
-	tmpmaps->content=NULL;*/
 	freeMaps(&tmpmaps);
 	free(tmpmaps);
-	  //}
 	tmpmaps=NULL;
 	free(tmp);
@@ -1805,6 +1797,5 @@
   freeService(&s1);
   free(s1);
-  //For Python language support only
-  //freeMaps(&m);
+  freeMaps(&m);
   free(m);
   
@@ -1812,7 +1803,6 @@
   free(request_input_real_format);
   
-  /* The following is requested but get issue using with Python support :/ */
-  /* freeMaps(&request_output_real_format);
-     free(request_output_real_format);*/
+  freeMaps(&request_output_real_format);
+  free(request_output_real_format);
   
   free(REQUEST);
