]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- improved memory handling 1149/head
authorArvin Schnell <aschnell@suse.de>
Fri, 19 Jun 2026 08:16:51 +0000 (10:16 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 19 Jun 2026 08:16:51 +0000 (10:16 +0200)
snapper/AppUtil.cc

index 454ad57128a8850e10aadba659cc610206f5b12d..6e528fcdf2f9259425ede4d03b1612db33a5d902 100644 (file)
@@ -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;
     }