aboutsummaryrefslogtreecommitdiff
path: root/src/librc/librc.c
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-25 03:47:10 +0000
committerMike Frysinger <vapier@gentoo.org>2023-01-25 00:48:26 -0500
commitd6a5264a9df5a8cddb8c4ad04998618bf98f7190 (patch)
tree167df1f48612bc91be9ddf3a74ace1959aaad7e7 /src/librc/librc.c
parent9f227e8b496f226ced053d6bef81e604d6878091 (diff)
librc: fix 'init' memory leak
From scan-build w/ clang-16.0.0_pre20230107: ``` ../src/librc/librc.c:759:14: warning: Potential leak of memory pointed to by 'init' [unix.Malloc] return false; ^~~~~ ```
Diffstat (limited to 'src/librc/librc.c')
-rw-r--r--src/librc/librc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 7802cc41..34598529 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -755,8 +755,10 @@ rc_service_mark(const char *service, const RC_SERVICE state)
RC_SVCDIR "/%s/%s",
rc_parse_service_state(RC_SERVICE_WASINACTIVE),
base);
- if (symlink(init, was) == -1)
+ if (symlink(init, was) == -1) {
+ free(init);
return false;
+ }
skip_wasinactive = true;
}
if (unlink(file) == -1) {