]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Small memory leak in src ACL parse
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 6 Oct 2012 02:18:46 +0000 (20:18 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 6 Oct 2012 02:18:46 +0000 (20:18 -0600)
Fixes one minor memory leak when IPv6 is disabled and parsing an IPv6
address. For example the default localhost ACL ::1 value.

Caught by Valgrind:

==26647== 384 bytes in 4 blocks are definitely lost in loss record 1,132 of 1,726
==26647==    at 0x4C25A28: calloc (vg_replace_malloc.c:467)
==26647==    by 0x65B441: xcalloc (xalloc.cc:75)
==26647==    by 0x657B99: MemPoolMalloc::allocate() (MemPoolMalloc.cc:62)
==26647==    by 0x5A95B1: acl_ip_data::FactoryParse(char const*) (Ip.h:66)
==26647==    by 0x5AA8BD: ACLIP::parse() (Ip.cc:523)
==26647==    by 0x5E0A80: ACL::ParseAclLine(ConfigParser&, ACL**) (Acl.cc:174)
==26647==    by 0x4B0C0F: parse_line(char*) (cache_cf.cc:1252)
==26647==    by 0x4B2076: parseOneConfigFile(char const*, unsigned int) (cache_cf.cc:518)
==26647==    by 0x4B29D0: parseConfigFile(char const*) (cache_cf.cc:558)
==26647==    by 0x546B81: SquidMain(int, char**) (main.cc:1372)
==26647==    by 0x547445: main (main.cc:1215)

src/acl/Ip.cc

index b1c05c360c5b631dfad1ef8c25107f6c6bbfdbab..d95b065a362a67027c1867ceb98ceb1c0d72b172 100644 (file)
@@ -471,6 +471,7 @@ acl_ip_data::FactoryParse(const char *t)
     /* ignore IPv6 addresses when built with IPv4-only */
     if ( iptype == AF_INET6 && !Ip::EnableIpv6) {
         debugs(28, DBG_IMPORTANT, "aclIpParseIpData: IPv6 has not been enabled.");
+        delete q;
         return NULL;
     }