mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: free the glob result of r, R, w, z, and Z entries
Same leak as for e entries: the path list from glob() was never freed.
With the address sanitizer LeakSanitizer makes tmpfiles exit with an
error:
tmpfiles --remove r.conf
Free the list in glob_do() and after the loops for w and z/Z.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+3
@@ -108,6 +108,7 @@ static int glob_do(const char *path, int (*cb)(const char *))
|
||||
|
||||
for (size_t i = 0; i < gl.gl_pathc; i++)
|
||||
rc += cb(gl.gl_pathv[i]);
|
||||
globfree(&gl);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -1016,6 +1017,7 @@ static void tmpfiles(char *line)
|
||||
rc = fclose(fp);
|
||||
}
|
||||
}
|
||||
globfree(&gl);
|
||||
break;
|
||||
case 'X':
|
||||
case 'x':
|
||||
@@ -1032,6 +1034,7 @@ static void tmpfiles(char *line)
|
||||
|
||||
for (size_t i = 0; i < gl.gl_pathc; i++)
|
||||
systemf("restorecon %s %s", opts, gl.gl_pathv[i]);
|
||||
globfree(&gl);
|
||||
break;
|
||||
default:
|
||||
errx(1, "Unsupported tmpfiles command '%s'", type);
|
||||
|
||||
Reference in new issue
Block a user