Index: trunk/zoo-project/zoo-kernel/service_internal_java.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_java.c	(revision 760)
+++ trunk/zoo-project/zoo-kernel/service_internal_java.c	(revision 765)
@@ -85,6 +85,7 @@
   fprintf(stderr,"(%s)\n",oclasspath);
 #endif
-
+#ifndef WIN32
   int nb=1;
+#endif
   int nbc0=0;
   maps* javaXXMap=getMaps(*main_conf,"javaxx");
@@ -98,6 +99,7 @@
   }
 #ifdef WIN32
-  nb=2+nbc0+nbc1;
-  JavaVMOption options[nb];
+  //#define nb (2+nbc0+nbc1)
+  const int nb=2+nbc0+nbc1;
+  JavaVMOption *options=(JavaVMOption*)malloc(nb*sizeof(JavaVMOption));
 #else
   JavaVMOption options[nb+nbc0+nbc1+1];
@@ -259,4 +261,7 @@
     free(options[start+i].optionString);
   }
+#ifdef WIN32
+  free(options);
+#endif
   return res;
 }
Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 760)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 765)
@@ -161,4 +161,38 @@
         str[i] = toReplaceBy;
     }
+}
+
+/**
+ * Dump back the final file fbkp1 to fbkp
+ *
+ * @param m the conf maps containing the main.cfg settings
+ * @param fbkp the string corresponding to the name of the file
+ * @param fbkp1 the string corresponding to the name of the file
+ */
+int dumpBackFinalFile(maps* m,char* fbkp,char* fbkp1)
+{
+  FILE *f2 = fopen (fbkp1, "rb");
+#ifndef RELY_ON_DB
+  semid lid = getShmLockId (m, 1);
+  if (lid < 0)
+    return -1;
+  lockShm (lid);
+#endif
+  FILE *f3 = fopen (fbkp, "wb+");
+  free (fbkp);
+  fseek (f2, 0, SEEK_END);
+  long flen = ftell (f2);
+  fseek (f2, 0, SEEK_SET);
+  char *tmps1 = (char *) malloc ((flen + 1) * sizeof (char));
+  fread (tmps1, flen, 1, f2);
+#ifdef WIN32
+  char *pchr=strrchr(tmps1,'>');
+  flen=strlen(tmps1)-strlen(pchr)+1;
+  tmps1[flen]=0;
+#endif
+  fwrite (tmps1, 1, flen, f3);
+  fclose (f2);
+  fclose (f3);
+  return 1;
 }
 
@@ -2137,4 +2171,10 @@
 	    freeService (&s1);
 	    free (s1);
+	    fclose (f0);
+	    fclose (f1);
+	    if(dumpBackFinalFile(m,fbkp,fbkp1)<0)
+	      return -1;
+	    unlink (fbkpid);
+	    unhandleStatus (m);
 	    freeMaps (&m);
 	    free (m);
@@ -2149,5 +2189,4 @@
 	    fflush (stdout);
 	    fflush (stderr);
-	    unhandleStatus (m);
 	    return -1;
 	  }
@@ -2190,36 +2229,16 @@
   signal (SIGABRT, donothing);
 #endif
+  
   if (((int) getpid ()) != cpid || cgiSid != NULL)
     {
       fclose (stdout);
       fclose (stderr);
-      /**
-       * Dump back the final file fbkp1 to fbkp
-       */
+
       fclose (f0);
       fclose (f1);
 
-      FILE *f2 = fopen (fbkp1, "rb");
-#ifndef RELY_ON_DB
-      semid lid = getShmLockId (m, 1);
-      if (lid < 0)
-        return -1;
-      lockShm (lid);
-#endif
-      FILE *f3 = fopen (fbkp, "wb+");
-      free (fbkp);
-      fseek (f2, 0, SEEK_END);
-      long flen = ftell (f2);
-      fseek (f2, 0, SEEK_SET);
-      char *tmps1 = (char *) malloc ((flen + 1) * sizeof (char));
-      fread (tmps1, flen, 1, f2);
-#ifdef WIN32
-      char *pchr=strrchr(tmps1,'>');
-      flen=strlen(tmps1)-strlen(pchr)+1;
-      tmps1[flen]=0;
-#endif
-      fwrite (tmps1, 1, flen, f3);
-      fclose (f2);
-      fclose (f3);
+      if(dumpBackFinalFile(m,fbkp,fbkp1)<0)
+	return -1;
+
       unlink (fbkpid);
       switch(eres){
