]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Memory leak within prc_settitle
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 10 Jul 2024 14:05:29 +0000 (10:05 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 10 Jul 2024 14:05:29 +0000 (10:05 -0400)
app/maild.c
lib/subrou.c

index b177d8f51eb527292f087fda1640661aedb17e62..00877dbce3483f8c899fbe21d0ac474b4bd5c3c6 100644 (file)
@@ -39,16 +39,19 @@ while (proceed==true) {
   switch (phase) {
     case 0      :       //looping forever email receiving processes
       for (int i=0;i<iteration;i++) {
+        int attend;
+
         if (pidlst[i]!=(pid_t)0) {
           if (prc_checkprocess(pidlst[i])==true) 
             continue;
           }
+        attend=(random()%10)+10;
         switch (pidlst[i]=fork()) {
           case -1       :       //trouble trouble?
             pidlst[i]=(pid_t)0;
             break;
           case  0       :
-            (void) rec_getemail((random()%10)+10);
+            (void) rec_getemail(attend);
             (void) exit(0);     //email receiving task terminated
             break;
           default       :       
@@ -135,7 +138,10 @@ while (proceed==true) {
       (void) sig_trapsignal(true,sig_alrm);
       break;
     case 3      :       //doing main tash
-      (void) task(5);
+      if (prc_locking(appname,true,5)==true) {
+        (void) task(5);
+        (void) prc_locking(appname,false,1);
+        }
       break;
     case 4      :       //doing main tash
       (void) prc_cleantitle();
index 84f78d9e2b6532cc60f65b204917207945a9ea47..71b3d412132668c2115fbab99c7e176ceed8175e 100644 (file)
@@ -18,7 +18,7 @@
 
 //version definition 
 #define VERSION "0.1"
-#define RELEASE "12"
+#define RELEASE "13"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
@@ -315,11 +315,6 @@ if (mode!=modopen) {
       if (appname!=(char *)0)
         (void) free(appname);
       appname=strdup(APPNAME);
-      if (rootdir!=(char *)0) {
-        (void) free(rootdir);
-        status=-1;          //Rootdir should be found as NULL
-        }
-      rootdir=strdup("");
       (void) openlog(APPNAME,LOG_PID,LOG_DAEMON);
       (void) rou_alert(0,"Starting: %s-%s",APPNAME,rou_getversion());
       break;
@@ -330,10 +325,6 @@ if (mode!=modopen) {
         (void) free(appname);
         appname=(char *)0;
         }
-      if (rootdir!=(char *)0) {
-        (void) free(rootdir);
-        rootdir=(char *)0;
-        }
       break;
     default       :
       (void) fprintf(stderr,"Calling %s with wrong mode='%d' (Bug?!):",