From 4b24e011dc485102a68a8809621e718fc77830a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 17 May 2018 16:01:01 +0200 Subject: [PATCH] Free potentially allocated regexes from Params::evalGrep In Params::evalGrep regcomp allocates some internal space for the regex objects, which must be freed manually via regfree(). This was however only done when the call to regcomp() failed and not on success. As the regexes are needed later, they have to be deallocated by the destructor. --- src/exiv2.cpp | 8 ++++++++ src/exiv2app.hpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 5ff2879b..43ae937c 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -193,6 +193,14 @@ Params& Params::instance() return *instance_; } +Params::~Params() { +#if defined(EXV_HAVE_REGEX_H) + for (size_t i=0; i