From fd9a161e749e02d8139a1dbd813b507245a7db03 Mon Sep 17 00:00:00 2001 From: Wenfeng Liu Date: Mon, 7 May 2018 23:07:20 +0000 Subject: [PATCH] Use rvalue reference in ModSecurity::serverLog to avoid string copy --- src/modsecurity.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modsecurity.cc b/src/modsecurity.cc index 65b35763..5560d794 100644 --- a/src/modsecurity.cc +++ b/src/modsecurity.cc @@ -196,10 +196,9 @@ void ModSecurity::serverLog(void *data, std::shared_ptr rm) { } if (m_logProperties & TextLogProperty) { - char *d = strdup(rm->log().c_str()); - const void *a = static_cast(d); + std::string &&d = rm->log(); + const void *a = static_cast(d.c_str()); m_logCb(data, a); - free(d); return; }