]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/execute: fix strv memleak
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 25 Jan 2017 03:24:07 +0000 (22:24 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 25 Jan 2017 03:26:10 +0000 (22:26 -0500)
compile_read_write_paths() returns a normal strv from strv_copy(), and
setup_namespace() uses it read-only, so we should use strv_free to deallocate.

src/core/execute.c

index 06a291fd39421a5a2246f0293df16a0302260dc8..d0faba5a8588e1b680fe475879160ae26bac1aea 100644 (file)
@@ -1896,8 +1896,8 @@ static int compile_read_write_paths(
         _cleanup_strv_free_ char **l = NULL;
         char **rt;
 
-        /* Compile the list of writable paths. This is the combination of the explicitly configured paths, plus all
-         * runtime directories. */
+        /* Compile the list of writable paths. This is the combination of
+         * the explicitly configured paths, plus all runtime directories. */
 
         if (strv_isempty(context->read_write_paths) &&
             strv_isempty(context->runtime_directory)) {
@@ -1930,7 +1930,7 @@ static int apply_mount_namespace(Unit *u, const ExecContext *context,
                                  const ExecParameters *params,
                                  ExecRuntime *runtime) {
         int r;
-        _cleanup_free_ char **rw = NULL;
+        _cleanup_strv_free_ char **rw = NULL;
         char *tmp = NULL, *var = NULL;
         const char *root_dir = NULL;
         NameSpaceInfo ns_info = {