summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2023-04-12 16:59:21 +0200
committerDavid Tardon <dtardon@redhat.com>2023-04-12 17:13:52 +0200
commit90570f6107794a35a31529f7e253f21cd3c5c9b4 (patch)
tree02d31e974183610f5fcbc252b416c23bb0adb2fb /src/systemctl
parent27681563574d2f133436927739cb79cc2d94a11d (diff)
downloadsystemd-90570f6107794a35a31529f7e253f21cd3c5c9b4.tar.gz
systemctl: fix a memory leak
valgrind systemctl is-enabled --root=/ -l default.target >/dev/null ==746041== Memcheck, a memory error detector ==746041== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==746041== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info ==746041== Command: systemctl is-enabled --root=/ -l default.target ==746041== ==746041== ==746041== HEAP SUMMARY: ==746041== in use at exit: 8,251 bytes in 4 blocks ==746041== total heap usage: 3,440 allocs, 3,436 frees, 1,163,346 bytes allocated ==746041== ==746041== LEAK SUMMARY: ==746041== definitely lost: 24 bytes in 1 blocks ==746041== indirectly lost: 35 bytes in 1 blocks ==746041== possibly lost: 0 bytes in 0 blocks ==746041== still reachable: 8,192 bytes in 2 blocks ==746041== suppressed: 0 bytes in 0 blocks ==746041== Rerun with --leak-check=full to see details of leaked memory ==746041== ==746041== For lists of detected and suppressed errors, rerun with: -s ==746041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl-is-enabled.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/systemctl/systemctl-is-enabled.c b/src/systemctl/systemctl-is-enabled.c
index bc4fc54c5a..8d791deaf1 100644
--- a/src/systemctl/systemctl-is-enabled.c
+++ b/src/systemctl/systemctl-is-enabled.c
@@ -14,6 +14,8 @@ static int show_installation_targets_client_side(const char *name) {
char **p;
int r;
+ CLEANUP_ARRAY(changes, n_changes, install_changes_free);
+
p = STRV_MAKE(name);
flags = UNIT_FILE_DRY_RUN |
(arg_runtime ? UNIT_FILE_RUNTIME : 0);