336f121807d25e8762b218c6e00b03d3ab0aaef1
jcasper
  Mon Sep 22 09:34:47 2025 -0700
Certain free() calls should be freeMem() to match the allocation routine, refs #36389

diff --git src/hg/lib/fakeCurl.c src/hg/lib/fakeCurl.c
index b6d4017098e..427b785d45c 100644
--- src/hg/lib/fakeCurl.c
+++ src/hg/lib/fakeCurl.c
@@ -29,75 +29,75 @@
     new->udcSize = 0;
     return new;
 }
 
 void curl_easy_cleanup(CURL *curl)
 /* Free a curl object allocated with curl_easy_init().  Do not attempt
  * to use the pointer's value after calling this function on it.
  */
 {
     if (curl != NULL)
     {
         if (curl->udc)
             udcFileClose(&(curl->udc));
         // clear the local copies of URL strings
         if (curl->url)
-            free(curl->url);
+            freeMem(curl->url);
         if (curl->range)
-            free(curl->range);
+            freeMem(curl->range);
         free(curl);
     }
 }
 
 
 CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...)
 /* Configure a variety of options on a CURL object.  This supports a very small subset
  * of the options provided by the real curl library - the supported list right now is just:
  * CURLOPT_WRITEDATA, CURLOPT_RANGE, CURLOPT_WRITEFUNCTION, CURLOPT_HEADERFUNCTION, and
  * CURLOPT_URL.
  *
  * The header function will be invoked, but only on a faked subset of what the actual
  * header content would be - just a content range string.
  *
  * The CURLOPT_FOLLOWLOCATION and CURLOPT_USERAGENT settings are also accepted, but
  * the values are ignored (the udc implementation here always follows redirects and lacks
  * support for user-agent strings).
  */
 {
     va_list args;
     va_start(args, option);
     char *newUrl = NULL;
     switch (option) {
         case CURLOPT_WRITEDATA:
             curl->writeBuffer = va_arg(args, void *);
             break;
         case CURLOPT_RANGE:
             if (curl->range)
-                free(curl->range);
+                freeMem(curl->range);
             curl->range = cloneString(va_arg(args,char *));
             break;
         case CURLOPT_WRITEFUNCTION:
             curl->WriteFunction = va_arg(args, curl_write_callback);
             break;
         case CURLOPT_URL:
             newUrl = va_arg(args, char*);
             if (curl->url && sameString(curl->url, newUrl))
                 break;
             if (curl->udc)
                 udcFileClose(&(curl->udc));
             if (curl->url)
-                free(curl->url);
+                freeMem(curl->url);
             curl->url = cloneString(newUrl);
             break;
         case CURLOPT_FOLLOWLOCATION:
             // ignored
             break;
         case CURLOPT_USERAGENT:
             // ignored
             break;
         case CURLOPT_HEADERFUNCTION:
             curl->HeaderFunction = va_arg(args, curl_write_callback);
             break;
         case CURLOPT_FAILONERROR:
             curl->failonerror = 1;
             break;
         default: