INN commit: trunk/nnrpd (post.c)

INN Commit rra at isc.org
Sun Sep 26 16:00:38 UTC 2010


    Date: Sunday, September 26, 2010 @ 09:00:38
  Author: iulius
Revision: 9125

Do not forget to free a pointer.

Modified:
  trunk/nnrpd/post.c

--------+
 post.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Modified: post.c
===================================================================
--- post.c	2010-09-26 15:49:33 UTC (rev 9124)
+++ post.c	2010-09-26 16:00:38 UTC (rev 9125)
@@ -1059,11 +1059,17 @@
     if ((error = ValidNewsgroups(HDR(HDR__NEWSGROUPS), &modgroup)) != NULL)
         return error;
 
-    if ((error = ProcessHeaders(idbuff, modgroup != NULL)) != NULL)
+    if ((error = ProcessHeaders(idbuff, modgroup != NULL)) != NULL) {
+        if (modgroup != NULL)
+            free(modgroup);
 	return error;
+    }
 
-    if (i == 0 && HDR(HDR__CONTROL) == NULL)
+    if (i == 0 && HDR(HDR__CONTROL) == NULL) {
+        if (modgroup != NULL)
+            free(modgroup);
 	return "Article is empty";
+    }
 
     strlcpy(frombuf, HDR(HDR__FROM), sizeof(frombuf));
     for (i = 0, p = frombuf;p < frombuf + sizeof(frombuf);)
@@ -1158,6 +1164,7 @@
 	if (idbuff != NULL) {
 	    const char *retstr;
 	    retstr = MailArticle(modgroup, article);
+            /* MailArticle frees modgroup. */
 	    strlcpy (idbuff, "(mailed to moderator)", SMBUF);
 	    return retstr;
 	}




More information about the inn-committers mailing list