OSSP CVS Repository

ossp - Check-in [779]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 779
Date: 2001-Aug-28 13:31:22 (local)
2001-Aug-28 11:31:22 (UTC)
User:thl
Branch:
Comment: reduced dmalloc() complaints about non-free()d resources during one a "lmtp post arg cw.de.sd.apps.dev.test" run to zero regarding own code; A memoryleak in str library 0.9.5 was detected which was reported to and fixed by RSE;
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/.configure      1.4 -> 1.5     3 inserted, 3 deleted
ossp-pkg/lmtp2nntp/.cvsignore      1.7 -> 1.8     1 inserted, 0 deleted
ossp-pkg/lmtp2nntp/.dmallocrc      1.1 -> 1.2     7 inserted, 0 deleted
ossp-pkg/lmtp2nntp/00TODO      1.17 -> 1.18     4 inserted, 2 deleted
ossp-pkg/lmtp2nntp/README      1.2 -> 1.3     0 inserted, 5 deleted
ossp-pkg/lmtp2nntp/lmtp.c      1.16 -> 1.17     21 inserted, 8 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.30 -> 1.31     7 inserted, 1 deleted
ossp-pkg/lmtp2nntp/msg.c      1.12 -> 1.13     6 inserted, 0 deleted
ossp-pkg/lmtp2nntp/sa.c      1.5 -> 1.6     1 inserted, 1 deleted

ossp-pkg/lmtp2nntp/.configure 1.4 -> 1.5

--- .configure   2001/08/23 09:12:30     1.4
+++ .configure   2001/08/28 11:31:22     1.5
@@ -4,7 +4,7 @@
 fi
 PATH=/cw/bin:$PATH
 ./configure \
-   --prefix=/tmp/lmtp2nntp \
    --with-str=/cw \
-   --with-dmalloc=/cw \
-   --enable-debug
+#  --with-dmalloc=/cw \
+   --enable-debug \
+   --prefix=/tmp/lmtp2nntp


ossp-pkg/lmtp2nntp/.cvsignore 1.7 -> 1.8

--- .cvsignore   2001/08/20 11:32:59     1.7
+++ .cvsignore   2001/08/28 11:31:22     1.8
@@ -9,3 +9,4 @@
 lmtp2nntp
 lmtp2nntp.1
 lmtp2nntp-*.tar.gz
+dmalloc.log


ossp-pkg/lmtp2nntp/.dmallocrc 1.1 -> 1.2

--- .dmallocrc   2001/08/23 09:12:30     1.1
+++ .dmallocrc   2001/08/28 11:31:22     1.2
@@ -8,6 +8,7 @@
 
 # basic debugging
 debug1  log-stats, log-non-free, check-fence
+debug1f log-stats, log-non-free, log-nonfree-space, allow-free-null, check-fence
 
 # more logging and some heap checking
 debug2  log-stats, log-non-free, log-trans, \
@@ -18,3 +19,9 @@
         log-admin, check-fence, check-heap, check-lists, realloc-copy, \
         free-blank, error-abort
 
+# good utilities but allow free(NULL);
+debug3f log-stats, log-non-free, log-trans, \
+        log-admin, check-fence, check-heap, check-lists, realloc-copy, \
+        free-blank, error-abort, \
+        allow-free-null
+


ossp-pkg/lmtp2nntp/00TODO 1.17 -> 1.18

--- 00TODO       2001/08/27 14:29:11     1.17
+++ 00TODO       2001/08/28 11:31:22     1.18
@@ -2,11 +2,9 @@
 M=NNNN im Sendmail ergaenzen (weil Postfix gar nix hat) durch -l Commandline options fuer Maximum Message Size
 use "RFC1918-like" private Domainnames for @example.com (check which name is registered)
 whatsup draufleiten
-dmalloc
 RFC1891 ENVID
 RFC1891 6.2
 -h needs to understand multiple hosts as comma separated list
-NUL statt '\0'
 ID logging problem
 lmtp_response segfaults when a physical line ('\n' terminated) of the logical line input exceeds LMTP_LINE_MAXLEN.
 
@@ -29,3 +27,7 @@
 news-dus2.de.cw.net Feeder
 news.ecrc.de        Feeder/Reader
 
+  Debugging:
+  $ ./.configure [wegen --with-dmalloc!]
+  $ dmalloc -l dmalloc.log
+  $ dmalloc debug3


ossp-pkg/lmtp2nntp/README 1.2 -> 1.3

--- README       2001/08/23 09:12:30     1.2
+++ README       2001/08/28 11:31:22     1.3
@@ -1,8 +1,3 @@
 
   OSSP lmtp2nntp - Mail to News Gateway
 
-  Debugging:
-  $ ./.configure [wegen --with-dmalloc!]
-  $ dmalloc -l dmalloc.log
-  $ dmalloc debug3
-


ossp-pkg/lmtp2nntp/lmtp.c 1.16 -> 1.17

--- lmtp.c       2001/08/27 14:49:32     1.16
+++ lmtp.c       2001/08/28 11:31:22     1.17
@@ -143,10 +143,13 @@
 
     if (lmtp == NULL)
         return;
-    for (i = 0; (i < LMTP_MAXVERBS) && (lmtp->dispatch[i] != NULL); i++)
-        free(lmtp->dispatch[i]);    /* lmtp_register() */
-    free(lmtp->dispatch);           /* lmtp_create() */
-    free(lmtp);                     /* lmtp_create() */
+
+    for (i = 0; (i < LMTP_MAXVERBS) && (lmtp->dispatch[i] != NULL); i++) {
+        free(lmtp->dispatch[i]->verb); /* lmtp_register() */
+        free(lmtp->dispatch[i]);       /* lmtp_register() */
+    }
+    free(lmtp->dispatch);              /* lmtp_create() */
+    free(lmtp);                        /* lmtp_create() */
     return;
 }
 
@@ -216,7 +219,8 @@
     size_t offsetline; /* memorizing start of line when reallocing in the middle of a line */
 
     nBuf = 4096;
-    if ((cpBuf = (char *)malloc(nBuf)) == NULL) return LMTP_ERR_MEM;
+    if ((cpBuf = (char *)malloc(nBuf)) == NULL)
+        return LMTP_ERR_MEM;
     *cppBuf = cpBuf;                           /* tell caller about the buffer */
     cpPtr = cpBuf;                             /* initialize write cursor */
     cpLine = cpBuf;                            /* initialize start of line */
@@ -437,9 +441,10 @@
     /*  Print a welcome message then execute a request/ dispatch loop until
      *  request signals no more data. Each request is checked to contain a
      *  registered verb and if a verb is found the correspondig callback is
-     *  executed. The create() function usually cares to register a default
-     *  callback in order to handle unregistered verbs. The psoudoverb for
-     *  default is the empty string "".
+     *  executed. The lmtp_create() function usually cares to register a
+     *  default callback in order to handle unregistered verbs. The psoudoverb
+     *  for default is the empty string "" and the callback for this verb can
+     *  be overridden.
      */
     lmtp_rc_t rc = LMTP_OK;
     lmtp_req_t req;
@@ -447,6 +452,9 @@
     char *verb;
     int i;
 
+    req.verb = "";
+    req.msg = NULL;
+
     res.statuscode = "220";
     res.dsncode    = NULL;
     res.statusmsg  = "LMTP Service ready.";
@@ -457,6 +465,11 @@
         verb = req.verb;
         if ((i = verbindex(lmtp, verb)) != -1) {
             rc = lmtp->dispatch[i]->cb(lmtp, &lmtp->io, &req, lmtp->dispatch[i]->ctx);
+            if (req.msg != NULL)
+                free(req.msg);
+            req.verb = "";
+            req.msg = NULL;
+
             if (rc != LMTP_OK) 
                 break;
         }


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.30 -> 1.31

--- lmtp2nntp.c  2001/08/27 14:49:32     1.30
+++ lmtp2nntp.c  2001/08/28 11:31:22     1.31
@@ -342,6 +342,12 @@
     /* graceful shutdown */
     lmtp_gfs_quit(ctx);
     lmtp_gfs_lhlo(ctx);
+    lmtp_destroy(lmtp);
+    if (ctx->azGroupargs != NULL)
+        free(ctx->azGroupargs);
+    if (ctx != NULL)
+        free(ctx);
+    str_parse(NULL, NULL);
 
     return rc;
 }
@@ -496,7 +502,7 @@
         if (ctx->ns[i].s != -1)
             close(ctx->ns[i].s);
         if (ctx->ns[i].sa != NULL)
-            sa_destroy(ctx->ns[ctx->nsc].sa);
+            sa_destroy(ctx->ns[i].sa);
         if (ctx->ns[i].p != NULL)
             free(ctx->ns[i].p);
         if (ctx->ns[i].h != NULL)


ossp-pkg/lmtp2nntp/msg.c 1.12 -> 1.13

--- msg.c        2001/08/27 14:49:32     1.12
+++ msg.c        2001/08/28 11:31:22     1.13
@@ -78,6 +78,9 @@
      *
      * OUTPUTS
      *
+     * msg->cpMsg
+     * free()d and set to NULL
+     * 
      * msg->azHeaders, msg->asHeaders contains the headers in argz format, one
      * logical NUL-terminated line per header which might be wrapped into
      * multiple '\n'-ended physical lines. The "From " envelope, "Received:",
@@ -101,6 +104,9 @@
     if (str_parse(msg->cpMsg, "m/((?:.*?)\\n)\\n(.*)$/s", &cpHeaders, &msg->cpBody) <= 0)
         return MSG_ERR_SPLITHEADBODY;
 
+    free(msg->cpMsg);
+    msg->cpMsg = NULL;
+
     /* replace envelope From w/o colon by X-F: pseudotag. This eliminates the
      * special case of having one header, which is really an embedded
      * envelope, not ending with a colon while all others do. After splitting


ossp-pkg/lmtp2nntp/sa.c 1.5 -> 1.6

--- sa.c 2001/08/27 14:49:32     1.5
+++ sa.c 2001/08/28 11:31:22     1.6
@@ -212,8 +212,8 @@
 
     if (sa->sa_buf != NULL)
         free(sa->sa_buf);
-
     free(sa);
+
     return;
 }
 

CVSTrac 2.0.1