chiark / gitweb /
Add _cleanup_globfree_
[elogind.git] / src / shared / util.c
index 2f66597de30c71e1ffda578a83a7cf1e98ef7c99..52867a177981bd6206c27ea92b4b65f192595f54 100644 (file)
@@ -4322,7 +4322,7 @@ int in_group(const char *name) {
 }
 
 int glob_exists(const char *path) {
-        glob_t g;
+        glob_t _cleanup_globfree_ g = {};
         int r, k;
 
         assert(path);
@@ -4339,8 +4339,6 @@ int glob_exists(const char *path) {
         else
                 r = errno ? -errno : -EIO;
 
-        globfree(&g);
-
         return r;
 }