xfree/memfree tidyup in acl.c

From: Adrian Chadd <adrian@dont-contact.us>
Date: Wed, 16 Aug 2000 22:26:16 +0800

Ok, here's a quick tidyup of acl.c . Can someone double check to make sure I'm
using the right memAllocate/memFree's ?

Adrian

Index: acl.c
===================================================================
RCS file: /server/cvs-server/squid/squid/src/acl.c,v
retrieving revision 1.221
diff -u -r1.221 acl.c
--- acl.c 2000/08/11 19:33:09 1.221
+++ acl.c 2000/08/16 14:19:20
@@ -565,7 +565,7 @@
                 debug(28, 0) ("%s line %d: %s\n",
                     cfg_filename, config_lineno, config_input_line);
                 debug(28, 0) ("aclParseTimeSpec: IGNORING Bad time range\n");
- xfree(q);
+ memFree(q, MEM_ACL_TIME_DATA);
                 return;
             }
             q->start = h1 * 60 + m1;
@@ -574,7 +574,7 @@
                 debug(28, 0) ("%s line %d: %s\n",
                     cfg_filename, config_lineno, config_input_line);
                 debug(28, 0) ("aclParseTimeSpec: IGNORING Reversed time range\n");
- xfree(q);
+ memFree(q, MEM_ACL_TIME_DATA);
                 return;
             }
         }
@@ -784,7 +784,7 @@
     if (A->data == NULL) {
         debug(28, 0) ("aclParseAclLine: IGNORING invalid ACL: %s\n",
             A->cfgline);
- xfree(A);
+ memFree(A, MEM_ACL);
         return;
     }
     /* append */
@@ -854,14 +854,14 @@
         debug(28, 0) ("aclParseDenyInfoLine: missing 'error page' parameter.\n");
         return;
     }
- A = xcalloc(1, sizeof(acl_deny_info_list));
+ A = memAllocate(MEM_ACL_DENY_INFO_LIST);
     A->err_page_id = errorReservePageId(t);
     A->err_page_name = xstrdup(t);
     A->next = (acl_deny_info_list *) NULL;
     /* next expect a list of ACL names */
     Tail = &A->acl_list;
     while ((t = strtok(NULL, w_space))) {
- L = xcalloc(1, sizeof(acl_name_list));
+ L = memAllocate(MEM_ACL_NAME_LIST);
         xstrncpy(L->name, t, ACL_NAME_SZ);
         *Tail = L;
         Tail = &L->next;
@@ -870,7 +870,7 @@
         debug(28, 0) ("%s line %d: %s\n",
             cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseDenyInfoLine: deny_info line contains no ACL's, skipping\n");
- xfree(A);
+ memFree(A, MEM_ACL_DENY_INFO_LIST);
         return;
     }
     for (B = *head, T = head; B; T = &B->next, B = B->next); /* find the tail */
@@ -905,7 +905,7 @@
         debug(28, 0) ("%s line %d: %s\n",
             cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseAccessLine: expecting 'allow' or 'deny', got '%s'.\n", t);
- xfree(A);
+ memFree(A, MEM_ACL_ACCESS);
         return;
     }
 
@@ -926,7 +926,7 @@
             debug(28, 0) ("%s line %d: %s\n",
                 cfg_filename, config_lineno, config_input_line);
             debug(28, 0) ("aclParseAccessLine: ACL name '%s' not found.\n", t);
- xfree(L);
+ memFree(L, MEM_ACL_LIST);
             continue;
         }
         L->acl = a;
@@ -937,7 +937,7 @@
         debug(28, 0) ("%s line %d: %s\n",
             cfg_filename, config_lineno, config_input_line);
         debug(28, 0) ("aclParseAccessLine: Access line contains no ACL's, skipping\n");
- xfree(A);
+ memFree(A, MEM_ACL_ACCESS);
         return;
     }
     A->cfgline = xstrdup(config_input_line);
@@ -1978,7 +1978,7 @@
         }
         a_next = a->next;
         xfree(a->err_page_name);
- safe_free(a);
+ memFree(a, MEM_ACL_DENY_INFO_LIST);
     }
     *list = NULL;
 }

-- 
Adrian Chadd			"If Pascal was elite it would be cool,
<adrian@creative.net.au>	 but it isn't, so its not."
					-Joshua Goodall
Received on Wed Aug 16 2000 - 08:26:24 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:35 MST