10908e483b27da82141d9494b61a06154b339068
angie
Wed Apr 25 15:39:02 2012 -0700
Moving a freeMem inside an if where it belongs (according to commentsabout docRoot above, the problem should only manifest in command line mode
when docRoot can be NULL).
diff --git src/hg/lib/web.c src/hg/lib/web.c
index 24d24dc..27e561f 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1358,32 +1358,34 @@
if(hIsPreviewHost() || hIsPrivateHost())
linkWithTimestamp = dyStringCreate("%s/%s-%ld%s", dyStringContents(fullDirName), baseName, mtime, extension);
else
linkWithTimestamp = dyStringCreate("%s/%s-v%s%s", dyStringContents(fullDirName), baseName, CGI_VERSION, extension);
if(!fileExists(dyStringContents(linkWithTimestamp)))
errAbort("Cannot find correct version of file '%s'; this is due to an installation error\n\nError details: %s does not exist",
fileName, dyStringContents(linkWithTimestamp));
// Free up all that extra memory
dyStringFree(&realFileName);
dyStringFree(&fullDirName);
char *linkFull = dyStringCannibalize(&linkWithTimestamp);
char *link = linkFull;
if (docRoot != NULL)
+ {
link = cloneString(linkFull + strlen(docRoot) + 1);
freeMem(linkFull);
+ }
if (wrapInHtml) // wrapped for christmas
{
struct dyString *wrapped = dyStringNew(0);
if (js)
dyStringPrintf(wrapped,"\n", link);
else if (style)
dyStringPrintf(wrapped,"\n", link);
else // Will be image, since these are the only three choices allowed
dyStringPrintf(wrapped,"\n", link);
freeMem(link);
link = dyStringCannibalize(&wrapped);
}
return link;