trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1166422 [2/3] - in /trafficserver/traffic/trunk: iocore/cache/ iocore/cluster/ iocore/dns/ iocore/eventsystem/ iocore/hostdb/ iocore/net/ iocore/utils/ lib/records/ lib/ts/ mgmt/ mgmt/api/ mgmt/api/remote/ mgmt/cli/ mgmt/cluster/ mgmt/stat...
Date Wed, 07 Sep 2011 21:46:07 GMT
Modified: trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc Wed Sep  7 21:46:03 2011
@@ -127,8 +127,7 @@ CfgContextCommit(CfgContext * ctx, LLQ *
     strncat(new_text, rule, len);
     strncat(new_text, "\n", 1);
 
-    if (rule)
-      xfree(rule);
+    ats_free(rule);
     if (ele->getRuleType() != TS_TYPE_COMMENT)
       index++;
     ele = ctx->next(ele);
@@ -137,7 +136,7 @@ CfgContextCommit(CfgContext * ctx, LLQ *
   // commit new file
   ver = ctx->getVersion();
   ret = WriteFile(ctx->getFilename(), new_text, size, ver);
-  xfree(new_text);
+  ats_free(new_text);
   if (ret != TS_ERR_OKAY)
     return TS_ERR_FAIL;        // couldn't write file
 
@@ -169,8 +168,9 @@ CfgContextGet(CfgContext * ctx)
   // get copy of the file
   ret = ReadFile(ctx->getFilename(), &old_text, &size, &ver);
   if (ret != TS_ERR_OKAY) {
+    // TODO: Hmmm, this looks almost like a memory leak, why the strcmp ??
     if (old_text && strcmp(old_text, "") != 0)
-      xfree(old_text);          // need to free memory
+      ats_free(old_text);          // need to free memory
     return ret;                 // Pass the error code along
   }
   // store version number
@@ -189,14 +189,14 @@ CfgContextGet(CfgContext * ctx)
 
     ret = ctx->addEle(ele);
     if (ret != TS_ERR_OKAY) {
-      if (old_text)
-        xfree(old_text);        // need to free memory
+      ats_free(old_text);        // need to free memory
       return ret;
     }
   }
   delete(rule_list);            // free RuleList memory
+  // TODO: Hmmm, this looks almost like a memory leak, why the strcmp ??
   if (old_text && strcmp(old_text, "") != 0)
-    xfree(old_text);            // need to free memory
+    ats_free(old_text);            // need to free memory
   return TS_ERR_OKAY;
 }
 

Modified: trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc Wed Sep  7 21:46:03 2011
@@ -105,20 +105,16 @@ string_to_ip_addr_ele(const char *str)
       goto Lerror;
   }
 
-  if (ip_a)
-    xfree(ip_a);
-  if (ip_b)
-    xfree(ip_b);
+  ats_free(ip_a);
+  ats_free(ip_b);
   return ele;
 
 Lerror:
-  if (ip_a)
-    xfree(ip_a);
-  if (ip_b)
-    xfree(ip_b);
+  ats_free(ip_a);
+  ats_free(ip_b);
   TSIpAddrEleDestroy(ele);
-  return NULL;
 
+  return NULL;
 }
 
 
@@ -157,7 +153,7 @@ ip_addr_ele_to_string(TSIpAddrEle * ele)
       snprintf(buf, sizeof(buf), "%s", ip_a_str);
     }
 
-    xfree(ip_a_str);
+    ats_free(ip_a_str);
     str = xstrdup(buf);
 
     return str;
@@ -175,19 +171,16 @@ ip_addr_ele_to_string(TSIpAddrEle * ele)
     } else {                    // not cidr type
       snprintf(buf, sizeof(buf), "%s%c%s", ip_a_str, RANGE_DELIMITER, ip_b_str);
     }
-    if (ip_a_str)
-      xfree(ip_a_str);
-    if (ip_b_str)
-      xfree(ip_b_str);
+    ats_free(ip_a_str);
+    ats_free(ip_b_str);
     str = xstrdup(buf);
+
     return str;
   }
 
 Lerror:
-  if (ip_a_str)
-    xfree(ip_a_str);
-  if (ip_b_str)
-    xfree(ip_b_str);
+  ats_free(ip_a_str);
+  ats_free(ip_b_str);
   return NULL;
 }
 
@@ -264,7 +257,7 @@ ip_addr_list_to_string(IpAddrList * list
     else
       snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "%s%s", ip_str, delimiter);
     buf_pos = strlen(buf);
-    xfree(ip_str);
+    ats_free(ip_str);
 
     enqueue((LLQ *) list, ip_ele);      // return ip to list
   }
@@ -704,7 +697,7 @@ domain_list_to_string(TSDomainList list,
         buf_pos += psize;
     }
 
-    xfree(dom_str);
+    ats_free(dom_str);
     enqueue((LLQ *) list, domain);
   }
 
@@ -894,7 +887,7 @@ pdest_sspec_to_string(TSPrimeDestT pd, c
         }
         if (buf_pos<sizeof(buf) && (psize = snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "src_ip=%s ", src_ip))> 0)
           buf_pos += psize;
-        xfree(src_ip);
+        ats_free(src_ip);
       }
       // prefix?
       if (sspec->prefix) {
@@ -915,7 +908,7 @@ pdest_sspec_to_string(TSPrimeDestT pd, c
           if (buf_pos < sizeof(buf) &&
               (psize = snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "port=%s ", portStr)) > 0)
             buf_pos += psize;
-          xfree(portStr);
+          ats_free(portStr);
         }
       }
       // method
@@ -1681,36 +1674,36 @@ ccu_checkIpAddr(const char *addr, const 
   if ((addrToks.Initialize(new_addr, ALLOW_EMPTY_TOKS)) != 4 ||
       (minToks.Initialize((char *) min_addr, ALLOW_EMPTY_TOKS)) != 4 ||
       (maxToks.Initialize((char *) max_addr, ALLOW_EMPTY_TOKS)) != 4) {
-    xfree(new_addr);
+    ats_free(new_addr);
     return false;               // Wrong number of parts
   }
   // IP can't end in a "." either
   len = strlen(new_addr);
   if (new_addr[len - 1] == '.') {
-    xfree(new_addr);
+    ats_free(new_addr);
     return false;
   }
   // Check all four parts of the ip address to make
   //  sure that they are valid
   for (int i = 0; i < 4; i++) {
     if (!isNumber(addrToks[i])) {
-      xfree(new_addr);
+      ats_free(new_addr);
       return false;
     }
     // coverity[secure_coding]
     if (sscanf(addrToks[i], "%d", &addrQ) != 1 ||
         sscanf(minToks[i], "%d", &minQ) != 1 || sscanf(maxToks[i], "%d", &maxQ) != 1) {
-      xfree(new_addr);
+      ats_free(new_addr);
       return false;
     }
 
     if (addrQ<minQ || addrQ> maxQ) {
-      xfree(new_addr);
+      ats_free(new_addr);
       return false;
     }
   }
 
-  xfree(new_addr);
+  ats_free(new_addr);
   return true;
 }
 
@@ -2876,9 +2869,9 @@ void
 comment_ele_destroy(INKCommentEle * ele)
 {
   if (ele) {
-    if (ele->comment)
-      xfree(ele->comment);
-    xfree(ele);
+    ats_free(ele->comment);
+    ats_free(ele);
   }
+
   return;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/CoreAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CoreAPI.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CoreAPI.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CoreAPI.cc Wed Sep  7 21:46:03 2011
@@ -201,14 +201,12 @@ ProxyStateSet(TSProxyStateT state, TSCac
         goto Lerror;
 
       snprintf(tsArgs, MAX_BUF_SIZE, "%s", proxy_options);
-      xfree(proxy_options);
+      ats_free(proxy_options);
       break;
     }
 
     if (strlen(tsArgs) > 0) {   /* Passed command line args for proxy */
-      if (lmgmt->proxy_options) {
-        xfree(lmgmt->proxy_options);
-      }
+      ats_free(lmgmt->proxy_options);
       lmgmt->proxy_options = xstrdup(tsArgs);
       mgmt_log("[ProxyStateSet] Traffic Server Args: '%s'\n", lmgmt->proxy_options);
     }
@@ -553,10 +551,10 @@ ReadFile(TSFileNameT file, char **text, 
   ret = configFiles->getRollbackObj(fname, &file_rb);
   if (ret != TRUE) {
     Debug("FileOp", "[get_lines_from_file] Can't get Rollback for file: %s\n", fname);
-    xfree(fname);
+    ats_free(fname);
     return TS_ERR_READ_FILE;
   }
-  xfree(fname);
+  ats_free(fname);
   ver = file_rb->getCurrentVersion();
   file_rb->getVersion(ver, &old_file_content);
   *version = ver;
@@ -608,7 +606,7 @@ WriteFile(TSFileNameT file, char *text, 
     mgmt_log(stderr, "[CfgFileIO::WriteFile] ERROR getting rollback object\n");
     //goto generate_error_msg;
   }
-  xfree(fname);
+  ats_free(fname);
 
   // if version < 0 then, just use next version in sequence;
   // otherwise check if trying to commit an old version
@@ -800,9 +798,8 @@ SnapshotTake(char *snapshot_name)
   // XXX: Why was that offset to config dir?
   //      Any path should be prefix relative thought
   //
-  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir,
-                      snapDirFromRecordsConf);
-  xfree(snapDirFromRecordsConf);
+  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir, snapDirFromRecordsConf);
+  ats_free(snapDirFromRecordsConf);
 
   SnapResult result = configFiles->takeSnap(snapshot_name, snapDir);
   if (result != SNAP_OK)
@@ -827,12 +824,11 @@ SnapshotRestore(char *snapshot_name)
   // XXX: Why was that offset to config dir?
   //      Any path should be prefix relative thought
   //
-  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir,
-                      snapDirFromRecordsConf);
-  xfree(snapDirFromRecordsConf);
+  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir, snapDirFromRecordsConf);
+  ats_free(snapDirFromRecordsConf);
 
   SnapResult result = configFiles->restoreSnap(snapshot_name, snapDir);
-  xfree(snapDirFromRecordsConf);
+  ats_free(snapDirFromRecordsConf);
   if (result != SNAP_OK)
     return TS_ERR_FAIL;
   else
@@ -855,12 +851,11 @@ SnapshotRemove(char *snapshot_name)
   // XXX: Why was that offset to config dir?
   //      Any path should be prefix relative thought
   //
-  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir,
-                      snapDirFromRecordsConf);
-  xfree(snapDirFromRecordsConf);
+  Layout::relative_to(snapDir, sizeof(snapDir), Layout::get()->sysconfdir, snapDirFromRecordsConf);
+  ats_free(snapDirFromRecordsConf);
 
   SnapResult result = configFiles->removeSnap(snapshot_name, snapDir);
-  xfree(snapDirFromRecordsConf);
+  ats_free(snapDirFromRecordsConf);
   if (result != SNAP_OK)
     return TS_ERR_FAIL;
   else

Modified: trafficserver/traffic/trunk/mgmt/api/EventCallback.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/EventCallback.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/EventCallback.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/EventCallback.cc Wed Sep  7 21:46:03 2011
@@ -68,11 +68,7 @@ void
 delete_event_callback(EventCallbackT * event_cb)
 {
 
-  if (event_cb) {
-    // LAN - can't free the data if don't know what it is?
-    //if (event_cb->data) xfree(event_cb->data);
-    xfree(event_cb);
-  }
+  ats_free(event_cb);
   return;
 }
 
@@ -134,7 +130,7 @@ delete_callback_table(CallbackTable * cb
   //destroy lock
   ink_mutex_destroy(&cb_table->event_callback_lock);
 
-  xfree(cb_table);
+  ats_free(cb_table);
 
   return;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc Wed Sep  7 21:46:03 2011
@@ -76,9 +76,8 @@ void
 delete_event_client(EventClientT * client)
 {
   if (client) {
-    if (client->adr)
-      xfree(client->adr);
-    xfree(client);
+    ats_free(client->adr);
+    ats_free(client);
   }
   return;
 }
@@ -183,9 +182,7 @@ delete_event_queue(LLQ * q)
 
   while (!queue_is_empty(q)) {
     ele = (TSEvent *) dequeue(q);
-    if (ele) {
-      xfree(ele);
-    }
+    ats_free(ele);
   }
 
   delete_queue(q);
@@ -346,8 +343,7 @@ event_callback_main(void *arg)
 
             case EVENT_REG_CALLBACK:
               handle_event_reg_callback(client_entry, req);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("event", "[event_callback_main] ERROR: handle_event_reg_callback\n");
                 remove_event_client(client_entry, accepted_clients);
@@ -359,8 +355,7 @@ event_callback_main(void *arg)
             case EVENT_UNREG_CALLBACK:
 
               handle_event_unreg_callback(client_entry, req);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("event", "[event_callback_main] ERROR: handle_event_unreg_callback\n");
                 remove_event_client(client_entry, accepted_clients);

Modified: trafficserver/traffic/trunk/mgmt/api/GenericParser.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/GenericParser.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/GenericParser.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/GenericParser.cc Wed Sep  7 21:46:03 2011
@@ -37,12 +37,8 @@ Token::Token():name(NULL), value(NULL)
 
 Token::~Token()
 {
-  if (name) {
-    xfree(name);
-  }
-  if (value) {
-    xfree(value);
-  }
+  ats_free(name);
+  ats_free(value);
 }
 
 void
@@ -69,7 +65,7 @@ Token::setValue(const char *str)
     len = (len < BUFSIZ) ? len : BUFSIZ - 1;
     memcpy(value, str_copy, len);
     value[len] = '\0';
-    xfree(str_copy);
+    ats_free(str_copy);
   }
 }
 
@@ -88,8 +84,7 @@ Token::appendValue(const char *str)
     strncat(value, str_copy, BUFSIZ - strlen(value) - 1);;
   }
   firstTime = false;
-  if (str_copy)
-    xfree(str_copy);
+  ats_free(str_copy);
 }
 
 void
@@ -171,21 +166,11 @@ Rule::setErrorHint(const char *str)
 
 Rule::~Rule()
 {
-  if (tokenList) {
-    delete(tokenList);
-  }
-  if (m_comment) {
-    xfree(m_comment);
-  }
-  if (m_errorHint) {
-    xfree(m_errorHint);
-  }
-  if (m_ruleStr) {
-    xfree(m_ruleStr);
-  }
-  if (m_filename) {
-    xfree(m_filename);
-  }
+  delete tokenList;
+  ats_free(m_comment);
+  ats_free(m_errorHint);
+  ats_free(m_ruleStr);
+  ats_free(m_filename);
 }
 
 void
@@ -364,13 +349,13 @@ Rule::cacheParse(char *rule, unsigned sh
         //          printf("%s 1\n", subtoken);
         token->appendValue(newStr);
       }
-      xfree((char *) newStr);
+      ats_free((void*)newStr);
 
     } else {
       //      printf("%s 2\n", tokenStr);
       newStr = strtrim(tokenStr, '\"');
       token->appendValue(newStr);
-      xfree((char *) newStr);
+      ats_free((void*)newStr);
       insideQuote = inQuote(tokenStr);
       if (insideQuote) {
         //              printf("enqueue\n");
@@ -673,13 +658,13 @@ Rule::socksParse(char *rule)
           //          printf("%s 1\n", subtoken);
           token->appendValue(newStr);
         }
-        xfree((char *) newStr);
+        ats_free((void*)newStr);
 
       } else {
         //      printf("%s 2\n", tokenStr);
         newStr = strtrim(tokenStr, '\"');
         token->appendValue(newStr);
-        xfree((char *) newStr);
+        ats_free((void*)newStr);
         insideQuote = inQuote(tokenStr);
         if (insideQuote) {
           //              printf("enqueue\n");
@@ -760,13 +745,13 @@ Rule::splitdnsParse(char *rule)
         //          printf("%s 1\n", subtoken);
         token->appendValue(newStr);
       }
-      xfree((char *) newStr);
+      ats_free((void*)newStr);
 
     } else {
       //            printf("%s 2\n", tokenStr);
       newStr = strtrim(tokenStr, '\"');
       token->appendValue(newStr);
-      xfree((char *) newStr);
+      ats_free((void*)newStr);
       insideQuote = inQuote(tokenStr);
       if (insideQuote) {
         //              printf("enqueue\n");
@@ -912,9 +897,8 @@ RuleList::RuleList()
 
 RuleList::~RuleList()
 {
-  if (m_filename) {
-    xfree(m_filename);
-  }
+  ats_free(m_filename);
+
   Rule *rule = NULL;
   while ((rule = dequeue())) {
     delete rule;
@@ -1028,7 +1012,7 @@ RuleList::parse(char *fileBuf, TSFileNam
 
         snprintf(error_rule, error_rule_size, "#ERROR: %s", line);
         rule->setComment(error_rule);
-        xfree(error_rule);
+        ats_free(error_rule);
       }
     }
 
@@ -1077,6 +1061,6 @@ strtrim(const char *str_in, char chr)
   }
 
   char *newStr = xstrdup(str);
-  xfree(str_ptr);
+  ats_free(str_ptr);
   return newStr;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc Wed Sep  7 21:46:03 2011
@@ -70,7 +70,7 @@ _TSstrdup(const char *str, int length, c
 void
 _TSfree(void *ptr)
 {
-  xfree(ptr);
+  ats_free(ptr);
 }
 
 
@@ -499,11 +499,7 @@ TSStringListDestroy(TSStringList strl)
   /* dequeue each element and free it */
   while (!queue_is_empty((LLQ *) strl)) {
     str = (char *) dequeue((LLQ *) strl);
-
-    if (!str)
-      continue;
-
-    xfree(str);
+    ats_free(str);
   }
 
   delete_queue((LLQ *) strl);
@@ -595,11 +591,7 @@ TSIntListDestroy(TSIntList intl)
   /* dequeue each element and free it */
   while (!queue_is_empty((LLQ *) intl)) {
     iPtr = (int *) dequeue((LLQ *) intl);
-
-    if (!iPtr)
-      continue;
-
-    xfree(iPtr);
+    ats_free(iPtr);
   }
 
   delete_queue((LLQ *) intl);
@@ -710,11 +702,9 @@ tsapi void
 TSEventDestroy(TSEvent * event)
 {
   if (event) {
-    if (event->name)
-      xfree(event->name);
-    if (event->description)
-      xfree(event->description);
-    xfree(event);
+    ats_free(event->name);
+    ats_free(event->description);
+    ats_free(event);
   }
   return;
 }
@@ -734,11 +724,10 @@ tsapi void
 TSRecordEleDestroy(TSRecordEle * ele)
 {
   if (ele) {
-    if (ele->rec_name)
-      xfree(ele->rec_name);
+    ats_free(ele->rec_name);
     if (ele->rec_type == TS_REC_STRING && ele->string_val)
-      xfree(ele->string_val);
-    xfree(ele);
+      ats_free(ele->string_val);
+    ats_free(ele);
   }
   return;
 }
@@ -763,11 +752,9 @@ tsapi void
 TSIpAddrEleDestroy(TSIpAddrEle * ele)
 {
   if (ele) {
-    if (ele->ip_a)
-      xfree(ele->ip_a);
-    if (ele->ip_b)
-      xfree(ele->ip_b);
-    xfree(ele);
+    ats_free(ele->ip_a);
+    ats_free(ele->ip_b);
+    ats_free(ele);
   }
 
   return;
@@ -787,8 +774,7 @@ TSPortEleCreate(void)
 tsapi void
 TSPortEleDestroy(TSPortEle * ele)
 {
-  if (ele)
-    xfree(ele);
+  ats_free(ele);
   return;
 }
 
@@ -807,10 +793,8 @@ tsapi void
 TSDomainDestroy(TSDomain * ele)
 {
   if (ele) {
-    // this is okay because TSIpAddr is also a char*
-    if (ele->domain_val)
-      xfree(ele->domain_val);
-    xfree(ele);
+    ats_free(ele->domain_val);
+    ats_free(ele);
   }
 }
 
@@ -838,13 +822,11 @@ tsapi void
 TSSspecDestroy(TSSspec * ele)
 {
   if (ele) {
-    if (ele->prefix)
-      xfree(ele->prefix);
-    if (ele->suffix)
-      xfree(ele->suffix);
+    ats_free(ele->prefix);
+    ats_free(ele->suffix);
     if (ele->port)
       TSPortEleDestroy(ele->port);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -877,16 +859,13 @@ tsapi void
 TSPdSsFormatDestroy(TSPdSsFormat * ele)
 {
   if (ele) {
-    if (ele->pd_val)
-      xfree(ele->pd_val);
-    if (ele->sec_spec.src_ip)
-      xfree(ele->sec_spec.src_ip);
-    if (ele->sec_spec.prefix)
-      xfree(ele->sec_spec.prefix);
-    if (ele->sec_spec.suffix)
-      xfree(ele->sec_spec.suffix);
+    ats_free(ele->pd_val);
+    ats_free(ele->sec_spec.src_ip);
+    ats_free(ele->sec_spec.prefix);
+    ats_free(ele->sec_spec.suffix);
     if (ele->sec_spec.port)
       TSPortEleDestroy(ele->sec_spec.port);
+    ats_free(ele);
   }
   return;
 }
@@ -927,7 +906,7 @@ TSCacheEleDestroy(TSCacheEle * ele)
 {
   if (ele) {
     TSPdSsFormatDestroy(&(ele->cache_info));
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -971,13 +950,10 @@ tsapi void
 TSCongestionEleDestroy(TSCongestionEle * ele)
 {
   if (ele) {
-    if (ele->pd_val)
-      xfree(ele->pd_val);
-    if (ele->prefix)
-      xfree(ele->prefix);
-    if (ele->error_page_uri)
-      xfree(ele->error_page_uri);
-    xfree(ele);
+    ats_free(ele->pd_val);
+    ats_free(ele->prefix);
+    ats_free(ele->error_page_uri);
+    ats_free(ele);
   }
   return;
 }
@@ -1004,11 +980,10 @@ tsapi void
 TSHostingEleDestroy(TSHostingEle * ele)
 {
   if (ele) {
-    if (ele->pd_val)
-      xfree(ele->pd_val);
+    ats_free(ele->pd_val);
     if (ele->volumes)
       TSIntListDestroy(ele->volumes);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -1041,13 +1016,10 @@ tsapi void
 TSIcpEleDestroy(TSIcpEle * ele)
 {
   if (ele) {
-    if (ele->peer_hostname)
-      xfree(ele->peer_hostname);
-    if (ele->peer_host_ip_addr)
-      xfree(ele->peer_host_ip_addr);
-    if (ele->mc_ip_addr)
-      xfree(ele->mc_ip_addr);
-    xfree(ele);
+    ats_free(ele->peer_hostname);
+    ats_free(ele->peer_host_ip_addr);
+    ats_free(ele->mc_ip_addr);
+    ats_free(ele);
   }
   return;
 }
@@ -1075,7 +1047,7 @@ TSIpAllowEleDestroy(TSIpAllowEle * ele)
   if (ele) {
     if (ele->src_ip_addr)
       TSIpAddrEleDestroy(ele->src_ip_addr);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 
@@ -1105,13 +1077,10 @@ tsapi void
 TSLogFilterEleDestroy(TSLogFilterEle * ele)
 {
   if (ele) {
-    if (ele->filter_name)
-      xfree(ele->filter_name);
-    if (ele->log_field)
-      xfree(ele->log_field);
-    if (ele->compare_str)
-      xfree(ele->compare_str);
-    xfree(ele);
+    ats_free(ele->filter_name);
+    ats_free(ele->log_field);
+    ats_free(ele->compare_str);
+    ats_free(ele);
   }
   return;
 }
@@ -1137,11 +1106,9 @@ tsapi void
 TSLogFormatEleDestroy(TSLogFormatEle * ele)
 {
   if (ele) {
-    if (ele->name)
-      xfree(ele->name);
-    if (ele->format)
-      xfree(ele->format);
-    xfree(ele);
+    ats_free(ele->name);
+    ats_free(ele->format);
+    ats_free(ele);
   }
   return;
 }
@@ -1171,10 +1138,8 @@ tsapi void
 TSLogObjectEleDestroy(TSLogObjectEle * ele)
 {
   if (ele) {
-    if (ele->format_name)
-      xfree(ele->format_name);
-    if (ele->file_name)
-      xfree(ele->file_name);
+    ats_free(ele->format_name);
+    ats_free(ele->file_name);
     if (ele->collation_hosts)
       TSDomainListDestroy(ele->collation_hosts);
     if (ele->filters)
@@ -1183,7 +1148,7 @@ TSLogObjectEleDestroy(TSLogObjectEle * e
       TSStringListDestroy(ele->protocols);
     if (ele->server_hosts)
       TSStringListDestroy(ele->server_hosts);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -1218,7 +1183,7 @@ TSParentProxyEleDestroy(TSParentProxyEle
     TSPdSsFormatDestroy(&(ele->parent_info));
     if (ele->proxy_list)
       TSDomainListDestroy(ele->proxy_list);
-    xfree(ele);
+    ats_free(ele);
   }
 
   return;
@@ -1245,9 +1210,7 @@ TSVolumeEleCreate()
 tsapi void
 TSVolumeEleDestroy(TSVolumeEle * ele)
 {
-  if (ele) {
-    xfree(ele);
-  }
+  ats_free(ele);
   return;
 }
 
@@ -1271,11 +1234,10 @@ tsapi void
 TSPluginEleDestroy(TSPluginEle * ele)
 {
   if (ele) {
-    if (ele->name)
-      xfree(ele->name);
+    ats_free(ele->name);
     if (ele->args)
       TSStringListDestroy(ele->args);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -1313,15 +1275,11 @@ void
 TSRemapEleDestroy(TSRemapEle * ele)
 {
   if (ele) {
-    if (ele->from_host)
-      xfree(ele->from_host);
-    if (ele->from_path_prefix)
-      xfree(ele->from_path_prefix);
-    if (ele->to_host)
-      xfree(ele->to_host);
-    if (ele->to_path_prefix)
-      xfree(ele->to_path_prefix);
-    xfree(ele);
+    ats_free(ele->from_host);
+    ats_free(ele->from_path_prefix);
+    ats_free(ele->to_host);
+    ats_free(ele->to_path_prefix);
+    ats_free(ele);
   }
 }
 
@@ -1355,11 +1313,9 @@ TSSocksEleDestroy(TSSocksEle * ele)
       TSIpAddrEleDestroy(ele->dest_ip_addr);
     if (ele->socks_servers)
       TSDomainListDestroy(ele->socks_servers);
-    if (ele->username)
-      xfree(ele->username);
-    if (ele->password)
-      xfree(ele->password);
-    xfree(ele);
+    ats_free(ele->username);
+    ats_free(ele->password);
+    ats_free(ele);
   }
 }
 
@@ -1386,15 +1342,13 @@ void
 TSSplitDnsEleDestroy(TSSplitDnsEle * ele)
 {
   if (ele) {
-    if (ele->pd_val)
-      xfree(ele->pd_val);
+    ats_free(ele->pd_val);
     if (ele->dns_servers_addrs)
       TSDomainListDestroy(ele->dns_servers_addrs);
-    if (ele->def_domain)
-      xfree(ele->def_domain);
+    ats_free(ele->def_domain);
     if (ele->search_list)
       TSDomainListDestroy(ele->search_list);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -1419,9 +1373,8 @@ void
 TSStorageEleDestroy(TSStorageEle * ele)
 {
   if (ele) {
-    if (ele->pathname)
-      xfree(ele->pathname);
-    xfree(ele);
+    ats_free(ele->pathname);
+    ats_free(ele);
   }
   return;
 }
@@ -1449,11 +1402,10 @@ void
 TSUpdateEleDestroy(TSUpdateEle * ele)
 {
   if (ele) {
-    if (ele->url)
-      xfree(ele->url);
+    ats_free(ele->url);
     if (ele->headers)
       TSStringListDestroy(ele->headers);
-    xfree(ele);
+    ats_free(ele);
   }
   return;
 }
@@ -1479,11 +1431,9 @@ void
 TSVirtIpAddrEleDestroy(TSVirtIpAddrEle * ele)
 {
   if (ele) {
-    if (ele->intr)
-      xfree(ele->intr);
-    if (ele->ip_addr)
-      xfree(ele->ip_addr);
-    xfree(ele);
+    ats_free(ele->intr);
+    ats_free(ele->ip_addr);
+    ats_free(ele);
   }
 }
 
@@ -2075,7 +2025,7 @@ TSReadFromUrlEx(const char *url, char **
   } else {
     httpHost = xstrdup(host_and_port);
   }
-  xfree(host_and_port);
+  ats_free(host_and_port);
 
   hFD = connectDirect(httpHost, httpPort, timeout);
   if (hFD == -1) {
@@ -2101,10 +2051,9 @@ TSReadFromUrlEx(const char *url, char **
   *body = xstrndup(bdy_temp, *bodySize);
 
 END:
-  if (httpHost)
-    xfree(httpHost);
-  if (httpPath)
-    xfree(httpPath);
+  ats_free(httpHost);
+  ats_free(httpPath);
+
   return status;
 }
 
@@ -2657,7 +2606,7 @@ resetHostName(TSRmServerEle * ele, const
 {
   char buff[MAX_RULE_SIZE];
 
-  xfree(ele->str_val);
+  ats_free(ele->str_val);
   snprintf(buff, sizeof(buff), "%s.%s", hostname, tail);
   ele->str_val = xstrdup(buff);
   return;

Modified: trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc Wed Sep  7 21:46:03 2011
@@ -228,7 +228,7 @@ preprocess_msg(struct SocketInfo sock_in
     *req = (char *)ats_malloc(sizeof(char) * (req_len + 1));
     ret = socket_read_n(sock_info, *req, req_len);
     if (ret != TS_ERR_OKAY) {
-      xfree(*req);
+      ats_free(*req);
       goto Lerror;
     }
     // add end of string to end of msg
@@ -495,7 +495,7 @@ send_reply_list(struct SocketInfo sock_i
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }
@@ -551,7 +551,7 @@ send_record_get_reply(struct SocketInfo 
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }
@@ -587,8 +587,7 @@ send_record_set_reply(struct SocketInfo 
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);
-
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }
@@ -642,8 +641,7 @@ send_file_read_reply(struct SocketInfo s
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, msg_len);
-
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }
@@ -709,8 +707,7 @@ send_event_active_reply(struct SocketInf
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);
-
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }
@@ -762,8 +759,7 @@ send_event_notification(struct SocketInf
 
   // now push it to the socket
   ret = socket_write_n(sock_info, msg, total_len);
-
-  xfree(msg);
+  ats_free(msg);
 
   return ret;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc Wed Sep  7 21:46:03 2011
@@ -75,9 +75,8 @@ void
 delete_client(ClientT * client)
 {
   if (client) {
-    if (client->adr)
-      xfree(client->adr);
-    xfree(client);
+    ats_free(client->adr);
+    ats_free(client);
   }
   return;
 }
@@ -215,8 +214,7 @@ ts_ctrl_main(void *arg)
             switch (op_t) {
             case RECORD_GET:
               ret = handle_record_get(client_entry->sock_info, req);
-              if (req)
-                xfree(req);     // free memory for req
+              ats_free(req);     // free memory for req
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_get\n");
                 remove_client(client_entry, accepted_con);
@@ -227,8 +225,7 @@ ts_ctrl_main(void *arg)
 
             case RECORD_SET:
               ret = handle_record_set(client_entry->sock_info, req);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_record_set\n");
                 remove_client(client_entry, accepted_con);
@@ -240,8 +237,7 @@ ts_ctrl_main(void *arg)
 
             case FILE_READ:
               ret = handle_file_read(client_entry->sock_info, req);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_read\n");
                 remove_client(client_entry, accepted_con);
@@ -253,8 +249,7 @@ ts_ctrl_main(void *arg)
 
             case FILE_WRITE:
               ret = handle_file_write(client_entry->sock_info, req);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_file_write\n");
                 remove_client(client_entry, accepted_con);
@@ -266,8 +261,7 @@ ts_ctrl_main(void *arg)
 
             case PROXY_STATE_GET:
               ret = handle_proxy_state_get(client_entry->sock_info);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_get\n");
                 remove_client(client_entry, accepted_con);
@@ -279,8 +273,7 @@ ts_ctrl_main(void *arg)
 
             case PROXY_STATE_SET:
               ret = handle_proxy_state_set(client_entry->sock_info, req);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_proxy_state_set\n");
                 remove_client(client_entry, accepted_con);
@@ -292,8 +285,7 @@ ts_ctrl_main(void *arg)
 
             case RECONFIGURE:
               ret = handle_reconfigure(client_entry->sock_info);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_reconfigure\n");
                 remove_client(client_entry, accepted_con);
@@ -305,8 +297,7 @@ ts_ctrl_main(void *arg)
 
             case RESTART:
               ret = handle_restart(client_entry->sock_info, req, false);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart\n");
                 remove_client(client_entry, accepted_con);
@@ -317,8 +308,7 @@ ts_ctrl_main(void *arg)
 
             case BOUNCE:
               ret = handle_restart(client_entry->sock_info, req, true);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_restart bounce\n");
                 remove_client(client_entry, accepted_con);
@@ -329,8 +319,7 @@ ts_ctrl_main(void *arg)
 
             case EVENT_RESOLVE:
               ret = handle_event_resolve(client_entry->sock_info, req);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_event_resolve\n");
                 remove_client(client_entry, accepted_con);
@@ -341,8 +330,7 @@ ts_ctrl_main(void *arg)
 
             case EVENT_GET_MLT:
               ret = handle_event_get_mlt(client_entry->sock_info);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:event_get_mlt\n");
                 remove_client(client_entry, accepted_con);
@@ -353,8 +341,7 @@ ts_ctrl_main(void *arg)
 
             case EVENT_ACTIVE:
               ret = handle_event_active(client_entry->sock_info, req);
-              if (req)
-                xfree(req);     // free the request allocated by preprocess_msg
+              ats_free(req);     // free the request allocated by preprocess_msg
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:event_active\n");
                 remove_client(client_entry, accepted_con);
@@ -367,8 +354,7 @@ ts_ctrl_main(void *arg)
             case SNAPSHOT_RESTORE:
             case SNAPSHOT_REMOVE:
               ret = handle_snapshot(client_entry->sock_info, req, op_t);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:handle_snapshot\n");
                 remove_client(client_entry, accepted_con);
@@ -379,8 +365,7 @@ ts_ctrl_main(void *arg)
 
             case SNAPSHOT_GET_MLT:
               ret = handle_snapshot_get_mlt(client_entry->sock_info);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR:snapshot_get_mlt\n");
                 remove_client(client_entry, accepted_con);
@@ -392,14 +377,13 @@ ts_ctrl_main(void *arg)
             case DIAGS:
               if (req) {
                 handle_diags(client_entry->sock_info, req);
-                xfree(req);
+                ats_free(req);
               }
               break;
 
             case STATS_RESET:
               ret = handle_stats_reset(client_entry->sock_info, req);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR: stats_reset\n");
                 remove_client(client_entry, accepted_con);
@@ -410,8 +394,7 @@ ts_ctrl_main(void *arg)
 
             case ENCRYPT_TO_FILE:
               ret = handle_encrypt_to_file(client_entry->sock_info, req);
-              if (req)
-                xfree(req);
+              ats_free(req);
               if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
                 Debug("ts_main", "[ts_ctrl_main] ERROR: encrypt_to_file");
                 remove_client(client_entry, accepted_con);
@@ -553,16 +536,13 @@ handle_record_set(struct SocketInfo sock
   ret = parse_request_name_value(req, &name, &val);
   if (ret != TS_ERR_OKAY) {
     ret = send_reply(sock_info, ret);
-    if (name)
-      xfree(name);
+    ats_free(name);
     return ret;
   }
   // call CoreAPI call on Traffic Manager side
   ret = MgmtRecordSet(name, val, &action);
-  if (name)
-    xfree(name);
-  if (val)
-    xfree(val);
+  ats_free(name);
+  ats_free(val);
 
   if (ret != TS_ERR_OKAY) {
     ret = send_reply(sock_info, ret);
@@ -611,9 +591,7 @@ handle_file_read(struct SocketInfo sock_
   if (ret != TS_ERR_OKAY) {
     ret = send_reply(sock_info, ret);
   }
-
-  if (text)
-    xfree(text);                // free memory allocated by ReadFile
+  ats_free(text);                // free memory allocated by ReadFile
 
   return ret;
 }
@@ -647,9 +625,7 @@ handle_file_write(struct SocketInfo sock
   // make CoreAPI call on Traffic Manager side
   ret = WriteFile(file, text, size, version);
   ret = send_reply(sock_info, ret);
-
-  if (text)
-    xfree(text);                // free memory allocated by parsing fn.
+  ats_free(text);                // free memory allocated by parsing fn.
 
   return ret;
 }
@@ -823,7 +799,7 @@ handle_event_get_mlt(struct SocketInfo s
     if (event_name) {
       snprintf(buf + buf_pos, (MAX_BUF_SIZE - buf_pos), "%s%c", event_name, REMOTE_DELIM);
       buf_pos += (strlen(event_name) + 1);
-      xfree(event_name);        //free the llq entry
+      ats_free(event_name);        //free the llq entry
     }
   }
   buf[buf_pos] = '\0';          //end the string
@@ -937,7 +913,7 @@ handle_snapshot_get_mlt(struct SocketInf
     if (snap_name) {
       snprintf(buf + buf_pos, (MAX_BUF_SIZE - buf_pos), "%s%c", snap_name, REMOTE_DELIM);
       buf_pos += (strlen(snap_name) + 1);
-      xfree(snap_name);         //free the llq entry
+      ats_free(snap_name);         //free the llq entry
     }
   }
   buf[buf_pos] = '\0';          //end the string
@@ -1009,14 +985,12 @@ handle_diags(struct SocketInfo sock_info
 
   if (diags_init) {
     diags->print("TSMgmtAPI", level, NULL, NULL, diag_msg);
-    if (diag_msg)
-      xfree(diag_msg);
+    ats_free(diag_msg);
     return;
   }
 
 Lerror:
-  if (diag_msg)
-    xfree(diag_msg);
+  ats_free(diag_msg);
   return;
 }
 
@@ -1071,18 +1045,14 @@ handle_encrypt_to_file(struct SocketInfo
   ret = parse_request_name_value(req, &pwd, &filepath);
   if (ret != TS_ERR_OKAY) {
     ret = send_reply(sock_info, ret);
-    if (pwd)
-      xfree(pwd);
-    if (filepath)
-      xfree(filepath);
+    ats_free(pwd);
+    ats_free(filepath);
     return ret;
   }
 
   ret = EncryptToFile(pwd, filepath);
   ret = send_reply(sock_info, ret);
-  if (pwd)
-    xfree(pwd);
-  if (filepath)
-    xfree(filepath);
+  ats_free(pwd);
+  ats_free(filepath);
   return ret;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/remote/APITestCliRemote.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/remote/APITestCliRemote.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/remote/APITestCliRemote.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/remote/APITestCliRemote.cc Wed Sep  7 21:46:03 2011
@@ -390,8 +390,7 @@ print_cache_ele(TSCacheEle * ele)
 
   snprintf(buf, sizeof(buf), "%s ", pd_str);
   buf_pos = strlen(buf);
-  xfree(pd_str);
-
+  ats_free(pd_str);
 
   // now format the message
   switch (ele->cfg_ele.type) {
@@ -412,14 +411,14 @@ print_cache_ele(TSCacheEle * ele)
     if (!time_str)
       return;
     snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "pin-in-cache=%s", time_str);
-    xfree(time_str);
+    ats_free(time_str);
     break;
   case TS_CACHE_REVALIDATE:
     time_str = hms_time_to_string(ele->time_period);
     if (!time_str)
       return;
     snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "revalidate=%s", time_str);
-    xfree(time_str);
+    ats_free(time_str);
     break;
   default:                     /* invalid action directive */
     printf("hello..\n");
@@ -712,7 +711,7 @@ print_split_dns_ele(TSSplitDnsEle * ele)
     strncat(buf, "named=", sizeof(buf) - strlen(buf) - 1);
     str = ip_addr_list_to_string((LLQ *) ele->dns_servers_addrs, " ");
     strncat(buf, str, sizeof(buf) - strlen(buf) - 1);
-    xfree(str);
+    ats_free(str);
     strncat(buf, " ", sizeof(buf) - strlen(buf) - 1);
   }
 
@@ -726,13 +725,11 @@ print_split_dns_ele(TSSplitDnsEle * ele)
     strncat(buf, "search_list=", sizeof(buf) - strlen(buf) - 1);
     str = domain_list_to_string(ele->search_list, " ");
     strncat(buf, str, sizeof(buf) - strlen(buf) - 1);
-    xfree(str);
+    ats_free(str);
     strncat(buf, " ", sizeof(buf) - strlen(buf) - 1);
   }
   printf("%s\n", buf);
-
-  if (pd_name)
-    xfree(pd_name);
+  ats_free(pd_name);
 
   return;
 }

Modified: trafficserver/traffic/trunk/mgmt/api/remote/CoreAPIRemote.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/remote/CoreAPIRemote.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/remote/CoreAPIRemote.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/remote/CoreAPIRemote.cc Wed Sep  7 21:46:03 2011
@@ -132,8 +132,7 @@ send_and_parse_list(OpType op, LLQ * lis
     tok = tokens.iterNext(&i_state);
   }
 
-  if (list_str)
-    xfree(list_str);
+  ats_free(list_str);
   return TS_ERR_OKAY;
 }
 
@@ -497,8 +496,7 @@ MgmtRecordGet(const char *rec_name, TSRe
     return TS_ERR_FAIL;
   }
 
-  if (val)
-    xfree(val);
+  ats_free(val);
   return TS_ERR_OKAY;
 }
 

Modified: trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc Wed Sep  7 21:46:03 2011
@@ -64,10 +64,8 @@ void
 set_socket_paths(const char *path)
 {
   // free previously set paths if needed
-  if (main_socket_path)
-    xfree(main_socket_path);
-  if (event_socket_path)
-    xfree(event_socket_path);
+  ats_free(main_socket_path);
+  ats_free(event_socket_path);
 
   // construct paths based on user input
   // form by replacing "mgmtapisocket" with "eventapisocket"
@@ -558,8 +556,7 @@ send_request_name(int fd, OpType op, cha
 
   // send message
   err = socket_write_conn(fd, msg_buf, total_len);
-  if (msg_buf)
-    xfree(msg_buf);
+  ats_free(msg_buf);
   return err;
 }
 
@@ -617,7 +614,7 @@ send_request_name_value(int fd, OpType o
 
   // send message
   err = socket_write_conn(fd, msg_buf, total_len);
-  xfree(msg_buf);
+  ats_free(msg_buf);
   return err;
 }
 
@@ -743,7 +740,7 @@ send_file_write_request(int fd, TSFileNa
 
   // send message
   err = socket_write_conn(fd, msg_buf, total_len);
-  xfree(msg_buf);
+  ats_free(msg_buf);
   return err;
 }
 
@@ -786,7 +783,7 @@ send_record_get_request(int fd, char *re
 
   // send message
   err = socket_write_conn(fd, msg_buf, total_len);
-  xfree(msg_buf);
+  ats_free(msg_buf);
   return err;
 }
 
@@ -885,7 +882,7 @@ send_register_all_callbacks(int fd, Call
       event_name = (char *) get_event_name(event_id);
       if (event_name) {
         err = send_request_name(fd, EVENT_REG_CALLBACK, event_name);
-        xfree(event_name);      // free memory
+        ats_free(event_name);      // free memory
         if (err != TS_ERR_OKAY) {
           send_err = err;       // save the type of send error
           no_errors = false;
@@ -949,7 +946,7 @@ send_unregister_all_callbacks(int fd, Ca
     if (reg_callback[k] == 0) { // event has no registered callbacks
       event_name = get_event_name(k);
       err = send_request_name(fd, EVENT_UNREG_CALLBACK, event_name);
-      xfree(event_name);
+      ats_free(event_name);
       if (err != TS_ERR_OKAY) {
         send_err = err;         //save the type of the sending error
         no_errors = false;
@@ -1011,8 +1008,7 @@ send_diags_msg(int fd, TSDiagsT mode, co
 
   // send message
   err = socket_write_conn(fd, msg_buf, total_len);
-  if (msg_buf)
-    xfree(msg_buf);
+  ats_free(msg_buf);
   return err;
 }
 
@@ -1154,13 +1150,13 @@ parse_reply_list(int fd, char **list)
       if (errno == EAGAIN)
         continue;
       else {
-        xfree(*list);
+        ats_free(*list);
         return TS_ERR_NET_READ;
       }
     }
 
     if (ret == 0) {
-      xfree(*list);
+      ats_free(*list);
       return TS_ERR_NET_EOF;
     }
 
@@ -1279,13 +1275,13 @@ parse_file_read_reply(int fd, int *ver, 
         if (errno == EAGAIN)
           continue;
         else {
-          xfree(*text);
+          ats_free(*text);
           return TS_ERR_NET_READ;
         }
       }
 
       if (ret == 0) {
-        xfree(*text);
+        ats_free(*text);
         return TS_ERR_NET_EOF;
       }
 
@@ -1405,13 +1401,13 @@ parse_record_get_reply(int fd, TSRecordT
       if (errno == EAGAIN)
         continue;
       else {
-        xfree(*rec_val);
+        ats_free(*rec_val);
         return TS_ERR_NET_READ;
       }
     }
 
     if (ret == 0) {
-      xfree(*rec_val);
+      ats_free(*rec_val);
       return TS_ERR_NET_EOF;
     }
 
@@ -1765,16 +1761,12 @@ parse_event_notification(int fd, TSEvent
   return TS_ERR_OKAY;
 
 ERROR_READ:
-  if (event_name)
-    xfree(event_name);
-  if (desc)
-    xfree(desc);
+  ats_free(event_name);
+  ats_free(desc);
   return TS_ERR_NET_READ;
 
 ERROR_EOF:
-  if (event_name)
-    xfree(event_name);
-  if (desc)
-    xfree(desc);
+  ats_free(event_name);
+  ats_free(desc);
   return TS_ERR_NET_EOF;
 }

Modified: trafficserver/traffic/trunk/mgmt/cli/CliMgmtUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/cli/CliMgmtUtils.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/cli/CliMgmtUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/cli/CliMgmtUtils.cc Wed Sep  7 21:46:03 2011
@@ -220,7 +220,7 @@ Cli_DisplayRules(TSFileNameT fname)
       // Fix TSqa12220: use printf directly since Cli_Printf may
       // not allocate enough buffer space to display the file contents
       puts(text);
-      xfree(text);
+      ats_free(text);
     } else {
       Cli_Printf("no rules\n");
     }
@@ -255,15 +255,13 @@ Cli_SetConfigFileFromUrl(TSFileNameT fil
   if ((status = TSConfigFileWrite(file, buf, size, version))) {
     Cli_Debug(ERR_CONFIG_FILE_WRITE, file);
     Cli_DisplayMgmtAPI_Error(status);
-    if (size) {
-      xfree(buf);
-    }
+    if (size)
+      ats_free(buf);
     return status;
   }
 
-  if (size) {
-    xfree(buf);
-  }
+  if (size)
+    ats_free(buf);
 
   Cli_Printf("Successfully updated config file.\n");
 

Modified: trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc (original)
+++ trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc Wed Sep  7 21:46:03 2011
@@ -387,7 +387,7 @@ ClusterCom::ClusterCom(unsigned long oip
   Debug("ccom", "[ClusterCom::ClusterCom] Using cluster conf: %s", cluster_conf);
   cluster_file_rb = new Rollback(cluster_file, false);
 
-  xfree(cluster_file);
+  ats_free(cluster_file);
 
   if (ink_sys_name_release(sys_name, sizeof(sys_name), sys_release, sizeof(sys_release)) >= 0) {
     mgmt_log("[ClusterCom::ClusterCom] Node running on OS: '%s' Release: '%s'\n", sys_name, sys_release);
@@ -950,12 +950,10 @@ ClusterCom::handleMultiCastStatPacket(ch
         }
 
         if (strcmp(tmp_msg_val, "NULL") == 0 && rec->data.rec_string) {
-          xfree(rec->data.rec_string);
+          ats_free(rec->data.rec_string);
           rec->data.rec_string = NULL;
         } else if (!(strcmp(tmp_msg_val, "NULL") == 0)) {
-          if (rec->data.rec_string) {
-            xfree(rec->data.rec_string);
-          }
+          ats_free(rec->data.rec_string);
           int rec_string_size = strlen(tmp_msg_val) + 1;
           ink_assert((rec->data.rec_string = (RecString)ats_malloc(rec_string_size)));
           ink_strncpy(rec->data.rec_string, tmp_msg_val, rec_string_size);
@@ -1017,7 +1015,7 @@ extract_locals(MgmtHashTable * local_ht,
       name = q;
       if (scan_and_terminate(q, ' ', '\t')) {
         Debug("ccom_rec", "[extract_locals] malformed line: %s\n", name);
-        xfree(line_cp);
+        ats_free(line_cp);
         continue;
       }
       local_ht->mgmt_hash_table_insert(name, line_cp);
@@ -1168,7 +1166,7 @@ ClusterCom::handleMultiCastFilePacket(ch
               delete reply;
               reply = reply_new;
             }
-            xfree(our_rec_cfg_cp);
+            ats_free(our_rec_cfg_cp);
             delete our_rec_cfg;
             delete our_locals_ht;
           }
@@ -2370,7 +2368,7 @@ checkBackDoor(int req_fd, char *message)
           char *val = REC_readString(variable, &found);
           if (found) {
             rep_len = snprintf(reply, sizeof(reply), "\nRecord '%s' Val: '%s'\n", variable, val);
-            xfree(val);
+            ats_free(val);
           }
           break;
         }

Modified: trafficserver/traffic/trunk/mgmt/cluster/VMap.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/cluster/VMap.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/cluster/VMap.cc (original)
+++ trafficserver/traffic/trunk/mgmt/cluster/VMap.cc Wed Sep  7 21:46:03 2011
@@ -199,7 +199,7 @@ VMap::VMap(char *interface, unsigned lon
         lastlen = ifc.ifc_len;
       }
       len *= 2;
-      xfree(ifbuf);
+      ats_free(ifbuf);
     }
 
     ifr = ifc.ifc_req;
@@ -229,7 +229,7 @@ VMap::VMap(char *interface, unsigned lon
                 mgmt_log("[VMap::VMap] Already added interface '%s'. Not adding for"
                          " real IP '%s'\n", ifr->ifr_name, inet_ntoa(tmp_realip_info->real_ip));
               }
-              xfree(tmp_realip_info);
+              ats_free(tmp_realip_info);
             } else {
               ink_hash_table_insert(interface_realip_map, ifr->ifr_name, (void *) tmp_realip_info);
               num_nics++;
@@ -251,7 +251,7 @@ VMap::VMap(char *interface, unsigned lon
       ifr = (struct ifreq *) (((char *) ifr) + sizeof(*ifr));
 #endif
     }
-    xfree(ifbuf);
+    ats_free(ifbuf);
     close(tmp_socket);
   }
 
@@ -272,18 +272,14 @@ VMap::VMap(char *interface, unsigned lon
 
 VMap::~VMap()
 {
-  if (id_map) {
+  if (id_map)
     ink_hash_table_destroy_and_xfree_values(id_map);
-  }
+
   ink_hash_table_destroy_and_xfree_values(interface_realip_map);
   ink_hash_table_destroy(our_map);
   ink_hash_table_destroy(ext_map);
-  if (this->interface) {
-    xfree(this->interface);
-  }
-  if (addr_list) {
-    xfree(addr_list);
-  }
+  ats_free(this->interface);
+  ats_free(addr_list);
 }                               /* End VMap::~VMap */
 
 
@@ -364,7 +360,7 @@ VMap::lt_runGambit()
 
   if (conf_addr) {              /* If there was a conflict, resolve it */
     rl_resolveConflict(vaddr, conf_addr);
-    xfree(conf_addr);
+    ats_free(conf_addr);
   }
 
   ink_mutex_release(mutex);
@@ -514,7 +510,7 @@ VMap::rl_clearUnSeen(char *ip)
     if (strstr(key, ip)) {
       if (!*tmp) {
         ink_hash_table_delete(ext_map, key);    /* Safe in iterator? */
-        xfree(tmp);
+        ats_free(tmp);
       } else {
         numAddrs++;
       }
@@ -601,7 +597,7 @@ VMap::rl_map(char *virt_ip, char *real_i
 
     if (!upAddr(virt_ip)) {
       mgmt_elog(stderr, "[VMap::rl_map] upAddr failed\n");
-      xfree(entry);
+      ats_free(entry);
       return false;
     }
   }
@@ -637,7 +633,7 @@ VMap::rl_unmap(char *virt_ip, char *real
     }
   }
   ink_hash_table_delete(tmp, buf);
-  xfree(hash_value);
+  ats_free(hash_value);
   return true;
 }                               /* End VMap::rl_unmap */
 

Modified: trafficserver/traffic/trunk/mgmt/stats/StatType.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/stats/StatType.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/stats/StatType.cc (original)
+++ trafficserver/traffic/trunk/mgmt/stats/StatType.cc Wed Sep  7 21:46:03 2011
@@ -200,13 +200,8 @@ bool StatExprToken::assignTokenType()
 void
 StatExprToken::clean()
 {
-  if (m_token_name != NULL) {
-    xfree(m_token_name);
-  }
-
-  if (m_token_value_delta != NULL) {
-    delete(m_token_value_delta);
-  }
+  ats_free(m_token_name);
+  delete m_token_value_delta;
 }
 
 
@@ -460,18 +455,10 @@ StatObject::StatObject(unsigned identifi
 void
 StatObject::clean()
 {
-  if (m_expr_string) {
-    xfree(m_expr_string);
-  }
-  if (m_node_dest) {
-    delete m_node_dest;
-  }
-  if (m_cluster_dest) {
-    delete m_cluster_dest;
-  }
-  if (m_postfix) {
-    delete m_postfix;
-  }
+  ats_free(m_expr_string);
+  delete m_node_dest;
+  delete m_cluster_dest;
+  delete m_postfix;
 }
 
 

Modified: trafficserver/traffic/trunk/mgmt/tools/ConfigAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/tools/ConfigAPI.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/tools/ConfigAPI.cc (original)
+++ trafficserver/traffic/trunk/mgmt/tools/ConfigAPI.cc Wed Sep  7 21:46:03 2011
@@ -743,14 +743,14 @@ Config_RestoreNetConfig(char *file)
     TagValue = netXml.getXmlTagValue("HostName");
     if (TagValue != NULL) {
       Config_SetHostname(TagValue);
-      xfree(TagValue);
+      ats_free(TagValue);
     }
 
 
     TagValue = netXml.getXmlTagValue("DNSSearch");
     if (TagValue != NULL) {
       Config_SetDomain(TagValue);
-      xfree(TagValue);
+      ats_free(TagValue);
     }
 
     // Check that we always have eth0. If eth0 is missing, exit.
@@ -762,7 +762,7 @@ Config_RestoreNetConfig(char *file)
       TagValue = netXml.getXmlTagValueAndAttribute(eth, "PerNICDefaultGateway");
       if (TagValue != NULL) {
         Config_SetNIC_Gateway(eth, TagValue);
-        xfree(TagValue);
+        ats_free(TagValue);
       } else if (count == 0)
         break;
       snprintf(eth, sizeof(eth), "eth%d", ++count);
@@ -779,7 +779,7 @@ Config_RestoreNetConfig(char *file)
 #if defined(linux)
         activeInterface[count] = 1;
 #endif
-        xfree(TagValue);
+        ats_free(TagValue);
       } else if (count == 0)
         break;
       snprintf(eth, sizeof(eth), "eth%d", ++count);
@@ -805,7 +805,7 @@ Config_RestoreNetConfig(char *file)
       TagValue = netXml.getXmlTagValueAndAttribute(eth, "InterfaceNetmask");
       if (TagValue != NULL) {
         Config_SetNIC_Netmask(eth, TagValue);
-        xfree(TagValue);
+        ats_free(TagValue);
       } else if (count == 0)
         break;
       snprintf(eth, sizeof(eth), "eth%d", ++count);
@@ -814,20 +814,20 @@ Config_RestoreNetConfig(char *file)
     TagValue = netXml.getXmlTagValue("DefaultGateway");
     if (TagValue != NULL) {
       Config_SetDefaultRouter(TagValue);
-      xfree(TagValue);
+      ats_free(TagValue);
     }
 
 
     TagValue = netXml.getXmlTagValue("DNSServer");
     if (TagValue != NULL) {
       Config_SetDNS_Servers(TagValue);
-      xfree(TagValue);
+      ats_free(TagValue);
     }
 
     TagValue = netXml.getXmlTagValue("NTPServers");
     if (TagValue != NULL) {
       Config_SetNTP_Servers(0, TagValue);
-      xfree(TagValue);
+      ats_free(TagValue);
     }
 
     // Get Admin GUI encrypted password.
@@ -841,7 +841,7 @@ Config_RestoreNetConfig(char *file)
           top_action_req = action_need;
         DPRINTF(("Config_FloppyNetRestore: set new mail_address %s!\n", mail_address));
       }
-      xfree(mail_address);
+      ats_free(mail_address);
     }
 
     // Make sure this is the last entry in these series. We restart traffic server here and hence
@@ -859,7 +859,7 @@ Config_RestoreNetConfig(char *file)
 #endif
       }
     }
-    xfree(TagValue);
+    ats_free(TagValue);
   }
 
   setreuid(old_euid, old_euid); //happens only for floppy config

Modified: trafficserver/traffic/trunk/mgmt/tools/SysAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/tools/SysAPI.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/tools/SysAPI.cc (original)
+++ trafficserver/traffic/trunk/mgmt/tools/SysAPI.cc Wed Sep  7 21:46:03 2011
@@ -1008,7 +1008,7 @@ NetConfig_Action(int index, ...)
     command_path = Layout::relative_to(Layout::get()->bindir, "net_config");
     res = execv(command_path, (char* const*)argv);
 
-    xfree(command_path);
+    ats_free(command_path);
     if (res != 0) {
       DPRINTF(("[SysAPI] fail to call net_config\n"));
     }
@@ -1292,7 +1292,7 @@ TimeConfig_Action(int index, bool restar
     command_path = Layout::relative_to(Layout::get()->bindir, "time_config");
     res = execv(command_path, (char* const*)argv);
 
-    xfree(command_path);
+    ats_free(command_path);
     if (res != 0) {
       DPRINTF(("[SysAPI] fail to call time_config\n"));
     }
@@ -2504,7 +2504,7 @@ NetConfig_Action(int index, ...)
     }
     _exit(res);
   }
-  xfree(command_path);
+  ats_free(command_path);
   return 0;
 }
 
@@ -2772,7 +2772,7 @@ TimeConfig_Action(int index, bool restar
 
     command_path = Layout::relative_to(Layout::get()->bindir, "time_config");
     res = execv(command_path, (char* const*) argv);
-    xfree(command_path);
+    ats_free(command_path);
     if (res != 0) {
       DPRINTF(("[SysAPI] fail to call time_config"));
     }

Modified: trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc (original)
+++ trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc Wed Sep  7 21:46:03 2011
@@ -45,10 +45,10 @@ ExpandingArray::~ExpandingArray()
 
   if (freeContentsOnDestruct == true) {
     for (int i = 0; i < numValidValues; i++) {
-      xfree(internalArray[i]);
+      ats_free(internalArray[i]);
     }
   }
-  xfree(internalArray);
+  ats_free(internalArray);
 }
 
 void *

Modified: trafficserver/traffic/trunk/mgmt/utils/MgmtSchema.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/utils/MgmtSchema.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/utils/MgmtSchema.cc (original)
+++ trafficserver/traffic/trunk/mgmt/utils/MgmtSchema.cc Wed Sep  7 21:46:03 2011
@@ -45,7 +45,6 @@ validateDefault(XMLNode * exposure, char
   }
 
   if (strcmp(exposure_level, "system") != 0 && strcmp(exposure_level, "unused") != 0) {
-
     RecGetRecordDefaultDataString_Xmalloc(recName, &rec_default);
 
     if (rec_default == NULL) {
@@ -60,10 +59,7 @@ validateDefault(XMLNode * exposure, char
           goto Lerror;
     }
   }
-
-  if (rec_default) {
-    //    xfree(rec_default);
-  }
+  ats_free(rec_default);
 
   return true;
 

Modified: trafficserver/traffic/trunk/mgmt/utils/MgmtUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/utils/MgmtUtils.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/utils/MgmtUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/utils/MgmtUtils.cc Wed Sep  7 21:46:03 2011
@@ -637,7 +637,7 @@ mgmt_getAddrForIntr(char *intrName, stru
       lastlen = ifc.ifc_len;
     }
     len *= 2;
-    xfree(ifbuf);
+    ats_free(ifbuf);
   }
 
   ifr = ifc.ifc_req;
@@ -671,7 +671,7 @@ mgmt_getAddrForIntr(char *intrName, stru
     ifr = (struct ifreq *) (((char *) ifr) + sizeof(*ifr));
 #endif
   }
-  xfree(ifbuf);
+  ats_free(ifbuf);
   close(fakeSocket);
 
 #else /* _WIN32 */

Modified: trafficserver/traffic/trunk/mgmt/utils/WebMgmtUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/utils/WebMgmtUtils.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/utils/WebMgmtUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/utils/WebMgmtUtils.cc Wed Sep  7 21:46:03 2011
@@ -542,14 +542,14 @@ varStrFromName(const char *varNameConst,
 
     // Return not found for unknown format options
     if (formatOption != 'b' && formatOption != 'm' && formatOption != 'c' && formatOption != 'p') {
-      xfree(varName);
+      ats_free(varName);
       return false;
     }
   }
 
   err = RecGetRecordDataType(varName, &varDataType);
   if (err == REC_ERR_FAIL) {
-    xfree(varName);
+    ats_free(varName);
     return false;
   }
 
@@ -596,14 +596,14 @@ varStrFromName(const char *varNameConst,
     } else {
       ink_strncpy(bufVal, data.rec_string, bufLen);
     }
-    xfree(data.rec_string);
+    ats_free(data.rec_string);
     break;
   default:
     found = false;
     break;
   }
 
-  xfree(varName);
+  ats_free(varName);
   return found;
 }
 
@@ -657,9 +657,8 @@ MgmtData::MgmtData()
 
 MgmtData::~MgmtData()
 {
-  if (type == RECD_STRING) {
-    xfree(data.rec_string);
-  }
+  if (type == RECD_STRING)
+    ats_free(data.rec_string);
 }
 
 // MgmtData::compareFromString(const char* str, strLen)
@@ -794,10 +793,10 @@ processFormSubmission(char *submission)
       }
 
       ink_hash_table_insert(nameVal, name, value);
-      xfree(name);
+      ats_free(name);
     }
   }
-  xfree(submission_copy);
+  ats_free(submission_copy);
 
   return nameVal;
 }
@@ -851,10 +850,10 @@ processFormSubmission_noSubstitute(char 
       }
 
       ink_hash_table_insert(nameVal, name, value);
-      xfree(name);
+      ats_free(name);
     }
   }
-  xfree(submission_copy);
+  ats_free(submission_copy);
 
   return nameVal;
 }
@@ -1453,7 +1452,7 @@ getFilesInDirectory(char *managedDir, Ex
     delete[]filePath;
   }
 
-  xfree(dirEntry);
+  ats_free(dirEntry);
   closedir(dir);
 #else
   // Append '\*' as a wildcard for FindFirstFile()

Modified: trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc Wed Sep  7 21:46:03 2011
@@ -160,14 +160,12 @@ WebFileImport_Xmalloc(const char *file, 
 
 Lerror:
 
-  if (*file_buf)
-    xfree(*file_buf);
+  ats_free(*file_buf);
   *file_buf = 0;
   *file_size = 0;
   err = WEB_HTTP_ERR_FAIL;
 
 Ldone:
-
   if (h_file != WEB_HANDLE_INVALID)
     WebFileClose(h_file);
 

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc Wed Sep  7 21:46:03 2011
@@ -255,7 +255,7 @@ handle_default(WebHttpContext * whc, con
   // open the requested file
   if ((h_file = WebFileOpenR(doc_root_file)) == WEB_HANDLE_INVALID) {
     //could not find file
-    xfree(doc_root_file);
+    ats_free(doc_root_file);
     response_hdr->setStatus(STATUS_NOT_FOUND);
     WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
     return WEB_HTTP_ERR_REQUEST_ERROR;
@@ -270,7 +270,7 @@ handle_default(WebHttpContext * whc, con
     response_hdr->setStatus(STATUS_NOT_FOUND);
     WebHttpSetErrorResponse(whc, STATUS_NOT_FOUND);
     WebFileClose(h_file);
-    xfree(doc_root_file);
+    ats_free(doc_root_file);
     return WEB_HTTP_ERR_REQUEST_ERROR;
   }
   // Check to see if the clients copy is up to date.  Ignore the
@@ -291,7 +291,7 @@ handle_default(WebHttpContext * whc, con
   response_hdr->setLastMod(file_date_gmt);
 
   WebFileClose(h_file);
-  xfree(doc_root_file);
+  ats_free(doc_root_file);
 
   return WEB_HTTP_ERR_OKAY;
 

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc Wed Sep  7 21:46:03 2011
@@ -100,10 +100,9 @@ WebHttpContextDestroy(WebHttpContext * w
       ink_hash_table_destroy(whc->submit_warn_ht);
     if (whc->submit_note_ht)
       ink_hash_table_destroy(whc->submit_note_ht);
-    if (whc->top_level_render_file)
-      xfree(whc->top_level_render_file);
-    if (whc->cache_query_result)
-      xfree(whc->cache_query_result);
-    xfree(whc);
+
+    ats_free(whc->top_level_render_file);
+    ats_free(whc->cache_query_result);
+    ats_free(whc);
   }
 }

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttpMessage.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttpMessage.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttpMessage.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttpMessage.cc Wed Sep  7 21:46:03 2011
@@ -384,27 +384,13 @@ httpMessage::addRequestBody(SocketInfo s
 
 httpMessage::~httpMessage()
 {
-  if (body != NULL) {
-    delete[]body;
-  }
-
-  if (file != NULL) {
-    delete[]file;
-  }
-
-  if (referer != NULL) {
-    delete[]referer;
-  }
-
-  if (conType_str != NULL) {
-    delete[]conType_str;
-  }
-
-  if (authMessage != NULL) {
-    delete[]authMessage;
-  }
+  delete[]body;
+  delete[]file;
+  delete[]referer;
+  delete[]conType_str;
+  delete[]authMessage;
 
-  xfree(client_request);
+  ats_free(client_request);
   delete parser;
 }
 
@@ -439,23 +425,11 @@ httpResponse::httpResponse()
 
 httpResponse::~httpResponse()
 {
-  if (explicitConType != NULL) {
-    xfree(explicitConType);
-  }
-
-  if (authRealm != NULL) {
-    xfree(authRealm);
-  }
-
-  if (refreshURL != NULL) {
-    xfree(refreshURL);
-  }
-
-  if (locationURL != NULL) {
-    xfree(locationURL);
-  }
-
-  xfree(dateResponse);
+  ats_free(explicitConType);
+  ats_free(authRealm);
+  ats_free(refreshURL);
+  ats_free(locationURL);
+  ats_free(dateResponse);
 }
 
 int

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc Wed Sep  7 21:46:03 2011
@@ -83,7 +83,7 @@ deleter_main(void *unused)
         if (now - session->created > SESSION_EXPIRES) {
           ink_hash_table_delete(g_session_ht, key);
           session->deleter_func(session->data);
-          xfree(session);
+          ats_free(session);
         } else {
           session_count++;
         }
@@ -196,7 +196,7 @@ WebHttpSessionDelete(char *key)
   }
   ink_hash_table_delete(g_session_ht, key);
   session->deleter_func(session->data);
-  xfree(session);
+  ats_free(session);
 Ldone:
   ink_mutex_release(&g_session_mutex);
   return err;

Modified: trafficserver/traffic/trunk/mgmt/web2/WebIntrMain.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebIntrMain.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebIntrMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebIntrMain.cc Wed Sep  7 21:46:03 2011
@@ -417,7 +417,7 @@ webIntr_main(void *x)
     int err;
 
     if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
-      xfree(autoconfContext.docRoot);
+      ats_free(autoconfContext.docRoot);
       autoconfContext.docRoot = xstrdup(system_config_directory);
       if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
         mgmt_elog("[WebIntrMain] unable to stat() directory '%s': %d %d, %s\n",
@@ -536,7 +536,7 @@ webIntr_main(void *x)
         ink_sem_post(&wGlobals.serviceThrCount);
 #endif
         ink_atomic_increment((int32_t *) & numServiceThr, -1);
-        xfree(clientInfo);
+        ats_free(clientInfo);
         close_socket(clientFD);
       } else {                  // IP is allowed
 
@@ -612,7 +612,7 @@ serviceThrMain(void *info)
     break;
   }
 
-  xfree(threadInfo->clientInfo);
+  ats_free(threadInfo->clientInfo);
 
   // Mark ourselves ready to be reaped
   ink_mutex_acquire(&wGlobals.serviceThrLock);

Modified: trafficserver/traffic/trunk/mgmt/web2/WebOverview.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebOverview.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebOverview.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebOverview.cc Wed Sep  7 21:46:03 2011
@@ -86,14 +86,14 @@ overviewRecord::overviewRecord(unsigned 
   if (name_found == false || name_l == NULL) {
     nameFailed.s_addr = inetAddr;
     mgmt_log("[overviewRecord::overviewRecord] Unable to find hostname for %s\n", inet_ntoa(nameFailed));
-    xfree(name_l);              // about to overwrite name_l, so we need to free it first
+    ats_free(name_l);              // about to overwrite name_l, so we need to free it first
     name_l = xstrdup(inet_ntoa(nameFailed));
   }
 
   const size_t hostNameLen = strlen(name_l) + 1;
   this->hostname = new char[hostNameLen];
   ink_strncpy(this->hostname, name_l, hostNameLen);
-  xfree(name_l);
+  ats_free(name_l);
 }
 
 overviewRecord::~overviewRecord()
@@ -423,12 +423,12 @@ overviewRecord::varStrFromName(const cha
 
     // Return not found for unknown format options
     if (formatOption != 'b' && formatOption != 'm' && formatOption != 'c' && formatOption != 'p') {
-      xfree(varName);
+      ats_free(varName);
       return false;
     }
   }
   if (RecGetRecordDataType(varName, &varDataType) == REC_ERR_FAIL) {
-    xfree(varName);
+    ats_free(varName);
     return false;
   }
 
@@ -474,7 +474,7 @@ overviewRecord::varStrFromName(const cha
     } else {
       ink_strncpy(bufVal, data.string_data, bufLen);
     }
-    xfree(data.string_data);
+    ats_free(data.string_data);
     break;
   case RECD_NULL:
   default:
@@ -482,7 +482,7 @@ overviewRecord::varStrFromName(const cha
     break;
   }
 
-  xfree(varName);
+  ats_free(varName);
   return found;
 }
 
@@ -1568,13 +1568,8 @@ overviewAlarmCallback(alarm_t newAlarm, 
 
 AlarmListable::~AlarmListable()
 {
-  if (ip != NULL) {
-    xfree(ip);
-  }
-
-  if (desc != NULL) {
-    xfree(desc);
-  }
+  ats_free(ip);
+  ats_free(desc);
 }
 
 // int hostSortFunc(const void* arg1, const void* arg2)

Modified: trafficserver/traffic/trunk/proxy/ControlMatcher.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ControlMatcher.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ControlMatcher.cc (original)
+++ trafficserver/traffic/trunk/proxy/ControlMatcher.cc Wed Sep  7 21:46:03 2011
@@ -241,10 +241,10 @@ template<class Data, class Result> Regex
 {
   for (int i = 0; i < num_el; i++) {
     pcre_free(re_array[i]);
-    xfree(re_str[i]);
+    ats_free(re_str[i]);
   }
   delete[]re_str;
-  xfree(re_array);
+  ats_free(re_array);
   delete[]data_array;
 }
 
@@ -330,7 +330,7 @@ template<class Data, class Result> char 
     num_el++;
   } else {
     // There was a problem so undo the effects this function
-    xfree(re_str[num_el]);
+    ats_free(re_str[num_el]);
     re_str[num_el] = NULL;
     pcre_free(re_array[num_el]);
     re_array[num_el] = NULL;
@@ -380,7 +380,7 @@ template<class Data, class Result> void 
     } // else it's -1 which means no match was found.
 
   }
-  xfree(url_str);
+  ats_free(url_str);
 }
 
 //
@@ -574,7 +574,7 @@ template<class Data, class Result>
     ink_release_assert(config_file != NULL);
     ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file);
   }
-  xfree(config_file);
+  ats_free(config_file);
 
   reMatch = NULL;
   hostMatch = NULL;
@@ -590,20 +590,12 @@ template<class Data, class Result>
 
 template<class Data, class Result> ControlMatcher<Data, Result>::~ControlMatcher()
 {
-  xfree(config_file_var);
+  ats_free(config_file_var);
 
-  if (reMatch != NULL) {
-    delete reMatch;
-  }
-  if (hostMatch != NULL) {
-    delete hostMatch;
-  }
-  if (ipMatch != NULL) {
-    delete ipMatch;
-  }
-  if (hrMatch != NULL) {
-    delete hrMatch;
-  }
+  delete reMatch;
+  delete hostMatch;
+  delete ipMatch;
+  delete hrMatch;
 }
 
 // void ControlMatcher<Data, Result>::Print()
@@ -705,7 +697,7 @@ template<class Data, class Result> int C
                    matcher_name, config_file_path, line_num, errPtr);
           SignalError(errBuf, alarmAlready);
         }
-        xfree(current);
+        ats_free(current);
       } else {
 
         // Line parsed ok.  Figure out what the destination
@@ -746,7 +738,7 @@ template<class Data, class Result> int C
 
   // Make we have something to do before going on
   if (numEntries == 0) {
-    xfree(first);
+    ats_free(first);
     return 0;
   }
   // Now allocate space for the record pointers
@@ -794,13 +786,13 @@ template<class Data, class Result> int C
     //   the NewEntry
     if (errPtr != NULL) {
       SignalError(errPtr, alarmAlready);
-      //xfree(errPtr); // XXX - why are we trying to free
+      //ats_free(errPtr); // XXX - why are we trying to free
       errPtr = NULL;
     }
     // Deallocate the parsing structure
     last = current;
     current = current->next;
-    xfree(last);
+    ats_free(last);
   }
 
   ink_assert(second_pass == numEntries);
@@ -825,7 +817,7 @@ template<class Data, class Result> int C
   }
 
   ret = BuildTableFromString(file_buf);
-  xfree(file_buf);
+  ats_free(file_buf);
   return ret;
 }
 

Modified: trafficserver/traffic/trunk/proxy/CoreUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/CoreUtils.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/CoreUtils.cc (original)
+++ trafficserver/traffic/trunk/proxy/CoreUtils.cc Wed Sep  7 21:46:03 2011
@@ -824,7 +824,7 @@ CoreUtils::load_http_hdr(HTTPHdr * core_
     str_size += nto_copy;
     str_heaps++;
 #if !defined(__GNUC__)
-    xfree(rw_heap);
+    ats_free(rw_heap);
 #endif
   }
 
@@ -849,7 +849,7 @@ CoreUtils::load_http_hdr(HTTPHdr * core_
       str_heaps++;
       str_size += heap->m_ronly_heap[i].m_heap_len;
 #if !defined(__GNUC__)
-      xfree(ro_heap);
+      ats_free(ro_heap);
 #endif
     }
   }
@@ -940,7 +940,7 @@ CoreUtils::dump_history(HttpSM * hsm)
     const char *msg = event_int_to_string(e, sizeof(buffer), buffer);
     printf("   event string: \"%s\"\n", msg);
 
-    xfree(fileline);
+    ats_free(fileline);
   }
 
   printf("-------- End History -----------\n\n");

Modified: trafficserver/traffic/trunk/proxy/CoreUtils.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/CoreUtils.h?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/CoreUtils.h (original)
+++ trafficserver/traffic/trunk/proxy/CoreUtils.h Wed Sep  7 21:46:03 2011
@@ -252,7 +252,7 @@ public:
   /**********************************************************************
   * purpose: loads a null terminated string from the core file
   * inputs: core file string address
-  * outputs: char* pointing to live string. call deallocs via xfree()
+  * outputs: char* pointing to live string. call deallocs via ats_free()
   ***********************************************************************/
   static char *load_string(const char *addr);
 

Modified: trafficserver/traffic/trunk/proxy/DiagsConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/DiagsConfig.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/DiagsConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/DiagsConfig.cc Wed Sep  7 21:46:03 2011
@@ -118,7 +118,7 @@ DiagsConfig::reconfigure_diags()
     all_found = all_found && found;
     if (found) {
       parse_output_string(p, &(c.outputs[l]));
-      xfree(p);
+      ats_free(p);
     } else {
       SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
       diags->print(NULL, DL_Error, NULL, &loc, "can't find config variable '%s'\n", record_name);
@@ -170,11 +170,8 @@ DiagsConfig::reconfigure_diags()
   ////////////////////////////////////
   // free the record.config strings //
   ////////////////////////////////////
-
-  if (dt)
-    xfree(dt);
-  if (at)
-    xfree(at);
+  ats_free(dt);
+  ats_free(at);
 }
 
 
@@ -422,5 +419,4 @@ DiagsConfig::~DiagsConfig()
     diags_log_fp = NULL;
   }
   delete diags;
-//  xfree(diags);
 }

Modified: trafficserver/traffic/trunk/proxy/FetchSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/FetchSM.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/FetchSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/FetchSM.cc Wed Sep  7 21:46:03 2011
@@ -40,7 +40,7 @@ FetchSM::cleanUp()
   mutex.clear();
   http_parser_clear(&http_parser);
   client_response_hdr.destroy();
-  xfree(client_response);
+  ats_free(client_response);
 
   PluginVC *vc = (PluginVC *) http_vc;
 

Modified: trafficserver/traffic/trunk/proxy/Freer.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Freer.h?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Freer.h (original)
+++ trafficserver/traffic/trunk/proxy/Freer.h Wed Sep  7 21:46:03 2011
@@ -94,9 +94,9 @@ struct FreerContinuation:Continuation
   {
     (void) event;
     (void) e;
-    xfree(p);
+    ats_free(p);
     delete this;
-      return EVENT_DONE;
+    return EVENT_DONE;
   }
   FreerContinuation(void *ap):Continuation(NULL), p(ap)
   {

Modified: trafficserver/traffic/trunk/proxy/ICP.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ICP.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ICP.cc (original)
+++ trafficserver/traffic/trunk/proxy/ICP.cc Wed Sep  7 21:46:03 2011
@@ -336,11 +336,11 @@ ICPPeerReadCont::reset(int full_reset)
     PeerReadDataAllocator.free(this->_state);
   }
   if (_cache_req_hdr_heap_handle) {
-    xfree(_cache_req_hdr_heap_handle);
+    ats_free(_cache_req_hdr_heap_handle);
     _cache_req_hdr_heap_handle = NULL;
   }
   if (_cache_resp_hdr_heap_handle) {
-    xfree(_cache_resp_hdr_heap_handle);
+    ats_free(_cache_resp_hdr_heap_handle);
     _cache_resp_hdr_heap_handle = NULL;
   }
 }
@@ -1087,7 +1087,7 @@ ICPRequestCont::~ICPRequestCont()
 
   if (_ICPmsg.h.opcode == ICP_OP_QUERY) {
     if (_ICPmsg.un.query.URL) {
-      xfree(_ICPmsg.un.query.URL);
+      ats_free(_ICPmsg.un.query.URL);
     }
   }
   if (pendingActions) {

Modified: trafficserver/traffic/trunk/proxy/IPAllow.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/IPAllow.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/IPAllow.cc (original)
+++ trafficserver/traffic/trunk/proxy/IPAllow.cc Wed Sep  7 21:46:03 2011
@@ -156,7 +156,7 @@ IpAllow::IpAllow(
   IPAllowReadConfigStringAlloc(config_file, (char *) config_file_var);
   ink_release_assert(config_file != NULL);
   ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file);
-  xfree(config_file);
+  ats_free(config_file);
 }
 
 IpAllow::~IpAllow()
@@ -294,6 +294,6 @@ IpAllow::BuildTable()
     Print();
   }
 
-  xfree(file_buf);
+  ats_free(file_buf);
   return 0;
 }

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Wed Sep  7 21:46:03 2011
@@ -730,7 +730,7 @@ FileImpl::fclose()
   }
 
   if (m_buf) {
-    xfree(m_buf);
+    ats_free(m_buf);
     m_buf = NULL;
     m_bufsize = 0;
     m_bufpos = 0;
@@ -1730,7 +1730,7 @@ TSPluginDirGet(void)
     }
     Layout::relative_to(path, sizeof(path),
                         Layout::get()->prefix, plugin_dir);
-    xfree(plugin_dir);
+    ats_free(plugin_dir);
   }
 
   return path;
@@ -2306,7 +2306,7 @@ TSMimeParserDestroy(TSMimeParser parser)
   sdk_assert(sdk_sanity_check_mime_parser(parser) == TS_SUCCESS);
 
   mime_parser_clear((MIMEParser *) parser);
-  xfree(parser);
+  ats_free(parser);
 }
 
 /***********/
@@ -3339,7 +3339,7 @@ TSHttpParserDestroy(TSHttpParser parser)
 {
   sdk_assert(sdk_sanity_check_http_parser(parser) == TS_SUCCESS);
   http_parser_clear((HTTPParser *) parser);
-  xfree(parser);
+  ats_free(parser);
 }
 
 /***********/
@@ -3883,8 +3883,7 @@ TSCacheKeyDestroy(TSCacheKey key)
 
   CacheInfo *i = (CacheInfo *) key;
 
-  if (i->hostname)
-    xfree(i->hostname);
+  ats_free(i->hostname);
   i->magic = CACHE_INFO_MAGIC_DEAD;
   delete i;
   return TS_SUCCESS;
@@ -6817,8 +6816,7 @@ void
 TSMatcherLineDestroy(TSMatcherLine ml)
 {
   sdk_assert(sdk_sanity_check_null_ptr((void*)ml) == TS_SUCCESS);
-  if (ml)
-    xfree(ml);
+  ats_free(ml);
 }
 
 const char *
@@ -7003,7 +7001,7 @@ TSRedirectUrlSet(TSHttpTxn txnp, const c
   HttpSM *sm = (HttpSM*) txnp;
 
   if (sm->redirect_url != NULL) {
-    xfree(sm->redirect_url);
+    ats_free(sm->redirect_url);
     sm->redirect_url = NULL;
     sm->redirect_url_len = 0;
   }

Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Wed Sep  7 21:46:03 2011
@@ -5478,7 +5478,7 @@ REGRESSION_TEST(SDK_API_TSTextLog) (Regr
   char *tmp = REC_ConfigReadString("proxy.config.log.logfile_dir");
   snprintf(logname, sizeof(logname), "RegressionTestLog%d.log", (int) getpid());
   snprintf(fullpath_logname, sizeof(fullpath_logname), "%s/%s", tmp, logname);
-  // xfree(tmp);
+  // ats_free(tmp);
 
   retVal = TSTextLogObjectCreate(logname, TS_LOG_MODE_ADD_TIMESTAMP, &log);
   if (retVal != TS_SUCCESS) {

Modified: trafficserver/traffic/trunk/proxy/InkXml.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkXml.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkXml.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkXml.cc Wed Sep  7 21:46:03 2011
@@ -42,8 +42,8 @@ InkXmlAttr::InkXmlAttr(char *tag, char *
 
 InkXmlAttr::~InkXmlAttr()
 {
-  xfree(m_tag);
-  xfree(m_value);
+  ats_free(m_tag);
+  ats_free(m_value);
 }
 
 void
@@ -64,7 +64,7 @@ InkXmlObject::InkXmlObject(char *object_
 
 InkXmlObject::~InkXmlObject()
 {
-  xfree(m_object_name);
+  ats_free(m_object_name);
   clear_tags();
 }
 
@@ -139,7 +139,7 @@ m_col(0)
 
 InkXmlConfigFile::~InkXmlConfigFile()
 {
-  xfree(m_config_file);
+  ats_free(m_config_file);
   clear_objects();
 }
 

Modified: trafficserver/traffic/trunk/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Main.cc?rev=1166422&r1=1166421&r2=1166422&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/Main.cc Wed Sep  7 21:46:03 2011
@@ -348,7 +348,7 @@ check_lockfile()
     }
     _exit(1);
   }
-  xfree(lockfile);
+  ats_free(lockfile);
 }
 
 static void
@@ -1176,7 +1176,7 @@ syslog_log_configure()
   }
   // TODO: Not really, what's up with this?
   Debug("server", "Setting syslog facility to %d\n", syslog_facility);
-  xfree(facility_str);
+  ats_free(facility_str);
 }
 
 // void syslog_thr_init()
@@ -1469,7 +1469,7 @@ change_uid_gid(const char *user)
       }
     }
   }
-  xfree(buf);
+  ats_free(buf);
 
   // Ugly but this gets reset when the process user ID is changed so
   // it must be udpated here.
@@ -1588,7 +1588,7 @@ main(int argc, char **argv)
     PreserveCapabilities();
     change_uid_gid(user);
     RestrictCapabilities();
-    xfree(user);
+    ats_free(user);
   }
 # endif
 
@@ -1649,7 +1649,7 @@ main(int argc, char **argv)
     char bwFilename[PATH_NAME_MAX];
 
     snprintf(bwFilename, sizeof(bwFilename), "%s/%s", system_config_directory, filename);
-    xfree(filename);
+    ats_free(filename);
 
     Debug("bw-mgmt", "Looking to read: %s for bw-mgmt", bwFilename);
     schema.LoadFile(bwFilename);



Mime
View raw message