Sure, that seems straightforward enough. Attached is a patch that
migrates lastAclData to an SBuf.
Thank you,
Nathan.
On 11 March 2016 at 14:38, Amos Jeffries <[email protected]> wrote:
> On 11/03/2016 11:56 a.m., Nathan Hoad wrote:
>> Hello,
>>
>> Attached is a patch that ensures lastAclData doesn't leak any data,
>> exactly the same as lastAclName.
>>
>> In my testing, this wasn't leaking very much memory, but a leak regardless.
>>
>
> +1.
>
> Since the 'sb' variable it's being set from is an SBuf, and the format
> codes can now handle SBuf too - would you mind taking a stab at making
> lastAclData itself an SBuf?
> That should get rid of some data-copy cycles and handle any related
> leaks hiding elsewhere.
>
> (just a request, if not that is fine and this can go in instead).
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> [email protected]
> http://lists.squid-cache.org/listinfo/squid-dev
Migrate lastAclData to an SBuf.
This is submitted on behalf of Bloomberg L.P.
=== modified file 'src/AccessLogEntry.cc'
--- src/AccessLogEntry.cc 2016-01-01 00:12:18 +0000
+++ src/AccessLogEntry.cc 2016-03-11 04:07:32 +0000
@@ -76,7 +76,6 @@
HTTPMSGUNLOCK(adapted_request);
safe_free(lastAclName);
- safe_free(lastAclData);
HTTPMSGUNLOCK(reply);
HTTPMSGUNLOCK(request);
=== modified file 'src/AccessLogEntry.h'
--- src/AccessLogEntry.h 2016-01-01 00:12:18 +0000
+++ src/AccessLogEntry.h 2016-03-11 04:25:25 +0000
@@ -42,7 +42,6 @@
AccessLogEntry() :
url(nullptr),
lastAclName(nullptr),
- lastAclData(nullptr),
reply(nullptr),
request(nullptr),
adapted_request(nullptr)
@@ -207,7 +206,7 @@
#endif
const char *lastAclName; ///< string for external_acl_type %ACL format code
- const char *lastAclData; ///< string for external_acl_type %DATA format code
+ SBuf lastAclData; ///< string for external_acl_type %DATA format code
HierarchyLogEntry hier;
HttpReply *reply;
=== modified file 'src/external_acl.cc'
--- src/external_acl.cc 2016-02-19 17:19:25 +0000
+++ src/external_acl.cc 2016-03-11 04:07:33 +0000
@@ -742,7 +742,7 @@
}
}
- ch->al->lastAclData = xstrdup(sb.c_str());
+ ch->al->lastAclData = sb;
}
#if USE_IDENT
=== modified file 'src/format/Format.cc'
--- src/format/Format.cc 2016-02-13 07:51:20 +0000
+++ src/format/Format.cc 2016-03-11 04:07:33 +0000
@@ -1381,7 +1381,7 @@
break;
case LFT_EXT_ACL_DATA:
- out = al->lastAclData;
+ out = al->lastAclData.c_str();
break;
}
_______________________________________________
squid-dev mailing list
[email protected]
http://lists.squid-cache.org/listinfo/squid-dev