From f3edc5dc86a2d819ae92998ccfc5ac507dbbc5b0 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 4 Mar 2017 19:38:41 +0200 Subject: [PATCH] lib: use delete[] to free buffer allocated using new[] Fix warning caught by clang: lib/regexp-fields.cc:41:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete buffer; ^ [] lib/regexp-fields.cc:37:17: note: allocated with 'new[]' here char *buffer = new char[len]; ^ --- lib/regexp-fields.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 9873af80..b4174750 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -38,7 +38,7 @@ compile_regex (regex_t ®exp, const char *str) std::string msg; (void) regerror (err, ®exp, buffer, len); msg.assign (buffer, len); - delete buffer; + delete[] buffer; throw Xapian::QueryParserError (msg); }