summaryrefslogtreecommitdiffstats
path: root/linux/SystemdMeter.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-05 14:47:49 +0100
committerBenBE <BenBE@geshi.org>2021-01-11 20:12:34 +0100
commit70f48f1f44bf419aac77de8664816a17122c8b29 (patch)
tree1959d394f65bf68a942e9ef4018f22a534eecfc3 /linux/SystemdMeter.c
parent958112c5a396815da7a731f406dbfd27bf713572 (diff)
Add wrapper function for free and strdup
Reduces code in callers and helps avoiding memory leaks.
Diffstat (limited to 'linux/SystemdMeter.c')
-rw-r--r--linux/SystemdMeter.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/linux/SystemdMeter.c b/linux/SystemdMeter.c
index 61bb59b3..75c666f8 100644
--- a/linux/SystemdMeter.c
+++ b/linux/SystemdMeter.c
@@ -213,8 +213,7 @@ static void updateViaExec(void) {
if (newline) {
*newline = '\0';
}
- free(systemState);
- systemState = xStrdup(lineBuffer + strlen("SystemState="));
+ free_and_xStrdup(&systemState, lineBuffer + strlen("SystemState="));
} else if (String_startsWith(lineBuffer, "NFailedUnits=")) {
nFailedUnits = strtoul(lineBuffer + strlen("NFailedUnits="), NULL, 10);
} else if (String_startsWith(lineBuffer, "NNames=")) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy