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; ^~~~~ ```
This commit is contained in:
parent
9f227e8b49
commit
d6a5264a9d
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user