From: Arvin Schnell Date: Fri, 19 Jun 2026 08:16:51 +0000 (+0200) Subject: - improved memory handling X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1149%2Fhead;p=thirdparty%2Fsnapper.git - improved memory handling --- diff --git a/snapper/AppUtil.cc b/snapper/AppUtil.cc index 454ad571..6e528fcd 100644 --- a/snapper/AppUtil.cc +++ b/snapper/AppUtil.cc @@ -64,10 +64,13 @@ namespace snapper glob_t globbuf; if (glob(path.c_str(), flags, 0, &globbuf) == 0) { - for (char** p = globbuf.gl_pathv; *p != 0; p++) - ret.push_back(*p); + ret.reserve(globbuf.gl_pathc); + + for (char** p = globbuf.gl_pathv; *p != 0; ++p) + ret.emplace_back(*p); + + globfree(&globbuf); } - globfree (&globbuf); return ret; }