4d8cff5b56a6f094513a1acb9fb48701f6fe169e
max
  Fri Mar 7 01:21:49 2014 -0800
woke up at night and suddenly remembered that url string should be on the stack,not on the heap.

diff --git src/hg/lib/cart.c src/hg/lib/cart.c
index 5d7fa4e..319401a 100644
--- src/hg/lib/cart.c
+++ src/hg/lib/cart.c
@@ -1356,34 +1356,33 @@
 int hgsid = getSessionId();
 struct sqlConnection *conn = cartDefaultConnector();
 clearDbContents(conn, "userDb", hguid);
 clearDbContents(conn, "sessionDb", hgsid);
 cartDefaultDisconnector(&conn);
 }
 
 void cartWriteCookie(struct cart *cart, char *cookieName)
 /* Write out HTTP Set-Cookie statement for cart. */
 {
 char *domain = cfgVal("central.domain");
 if (sameWord("HTTPHOST", domain))
     {
     // IE9 does not accept portnames in cookie domains
     char *hostWithPort = hHttpHost();
-    struct netParsedUrl *url;
-    AllocVar(url);
-    netParseUrl(hostWithPort, url);
-    domain = url->host;
+    struct netParsedUrl npu;
+    netParseUrl(hostWithPort, &npu);
+    domain = cloneString(npu.host);
     }
 
 printf("Set-Cookie: %s=%u; path=/; domain=%s; expires=%s\r\n",
         cookieName, cart->userInfo->id, domain, cookieDate());
 if(geoMirrorEnabled())
     {
     // This occurs after the user has manually choosen to go back to the original site; we store redirect value into a cookie so we 
     // can use it in subsequent hgGateway requests before loading the user's cart
     char *redirect = cgiOptionalString("redirect");
     if (redirect)
         {
         printf("Set-Cookie: redirect=%s; path=/; domain=%s; expires=%s\r\n", redirect, cgiServerName(), cookieDate());
         }
     }
 }