From 986c4450293b7f6203db8c999eafaf8e9d9e372e Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Wed, 1 Nov 2000 16:18:27 -0800
Subject: [PATCH] [svn] Fixed minor memory leaks.

---
 src/ChangeLog |  6 ++++++
 src/retr.c    | 11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index f4f7336f..833671f1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-02  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+	* retr.c (retrieve_url): Free url before returning.
+	(retrieve_url): Free mynewloc before returning.
+	Spotted by Mark A. Mankins <Mankins_Mark@prc.com>.
+
 2000-11-02  Hrvoje Niksic  <hniksic@arsdigita.com>
 
 	* url.c (parseurl): Remove possible reading past the end of
diff --git a/src/retr.c b/src/retr.c
index 5f9327a3..3d5a3210 100644
--- a/src/retr.c
+++ b/src/retr.c
@@ -344,6 +344,7 @@ retrieve_url (const char *origurl, char **file, char **newloc,
       logprintf (LOG_NOTQUIET, "%s: %s.\n", url, uerrmsg (result));
       freeurl (u, 1);
       free_slist (redirections);
+      free (url);
       return result;
     }
 
@@ -379,6 +380,7 @@ retrieve_url (const char *origurl, char **file, char **newloc,
 	  logputs (LOG_NOTQUIET, _("Could not find proxy host.\n"));
 	  freeurl (u, 1);
 	  free_slist (redirections);
+	  free (url);
 	  return PROXERR;
 	}
       /* Parse the proxy URL.  */
@@ -391,6 +393,7 @@ retrieve_url (const char *origurl, char **file, char **newloc,
 	    logprintf (LOG_NOTQUIET, _("Proxy %s: Must be HTTP.\n"), proxy);
 	  freeurl (u, 1);
 	  free_slist (redirections);
+	  free (url);
 	  return PROXERR;
 	}
       u->proto = URLHTTP;
@@ -452,6 +455,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
 	  freeurl (newloc_struct, 1);
 	  freeurl (u, 1);
 	  free_slist (redirections);
+	  free (url);
+	  free (mynewloc);
 	  return result;
 	}
 
@@ -469,6 +474,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
 	  freeurl (newloc_struct, 1);
 	  freeurl (u, 1);
 	  free_slist (redirections);
+	  free (url);
+	  free (mynewloc);
 	  return WRONGCODE;
 	}
 
@@ -481,6 +488,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
 	  freeurl (newloc_struct, 1);
 	  freeurl (u, 1);
 	  free_slist (redirections);
+	  free (url);
+	  free (mynewloc);
 	  return WRONGCODE;
 	}
 
@@ -600,7 +609,7 @@ downloaded_exceeds_quota (void)
   if (!opt.quota)
     return 0;
   if (opt.downloaded_overflow)
-    /* We don't really no.  (Wildly) assume not. */
+    /* We don't really know.  (Wildly) assume not. */
     return 0;
 
   return opt.downloaded > opt.quota;