# Re: \[PATCH v2\] selftests/livepatch: fix resource leak in test\_klp\_syscall init error path

- From: Miroslav Benes \<mbenes@suse.cz\>
- Date: 2026-06-05 06:51:08 
- List: live-patching
- Page: https://ratatoskr.run/live-patching/2026/06/17092178
- Thread: https://ratatoskr.run/live-patching/2026/06/17077954/t.md

```text
On 2026-06-04 16:32 +0800, Rui Qi wrote:
> In livepatch_init(), if klp_enable_patch() fails, the previously
> created kobject and sysfs file are never cleaned up, causing a
> resource leak. Capture the return value and add proper cleanup
> on the error path.
> 
> Signed-off-by: Rui Qi <redacted>

Acked-by: Miroslav Benes <mbenes@suse.cz>

```
