You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/05/28 23:47:41 UTC

svn commit: rev 20552 - incubator/spamassassin/trunk/spamc

Author: mss
Date: Fri May 28 14:47:40 2004
New Revision: 20552

Modified:
   incubator/spamassassin/trunk/spamc/spamc.c
Log:
bug 3441: make sure the string we free was allocated by us.


Modified: incubator/spamassassin/trunk/spamc/spamc.c
==============================================================================
--- incubator/spamassassin/trunk/spamc/spamc.c	(original)
+++ incubator/spamassassin/trunk/spamc/spamc.c	Fri May 28 14:47:40 2004
@@ -401,6 +401,11 @@
 int
 get_current_user(char **username)
 {
+    if (*username != NULL) {
+        *username = strdup(*username);
+	if (username == NULL)
+	    goto fail;
+    }
 #ifdef _WIN32
 
     return EX_OK;
@@ -475,11 +480,9 @@
        goto finish;
    }
    
-   if (username == NULL) {
-       ret = get_current_user(&username);
-       if ( ret != EX_OK )
-           goto finish;
-   }
+   ret = get_current_user(&username);
+   if (ret != EX_OK)
+       goto finish;
        
    if ((flags & SPAMC_RANDOMIZE_HOSTS) != 0) {
 	/* we don't need strong randomness; this is just so we pick