samples/landlock: fix path_list memory leak
Subsystems (2)
PATCH v2 1/1 samples/landlock: fix path_list memory leak
From: Tom Rix <[email protected]>
Clang static analysis reports this error
sandboxer.c:134:8: warning: Potential leak of memory
pointed to by 'path_list'
ret = 0;
^path_list is allocated in parse_path() but never freed.
Signed-off-by Tom Rix <[email protected]>
---
v2:
- Remove NULL ptr check
--- samples/landlock/sandboxer.c | 1 + 1 file changed, 1 insertion(+)
samples/landlock/sandboxer.c +1 -0
@@ -134,6 +134,7 @@ static int populate_ruleset( ret =0 ; out_free_name: +free (path_list);free (env_path_name);return ret; }
Signature · 1 line
2.26.3
Quoted 11 lines · On 28/04/2021 23:38, [email protected] wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this error
sandboxer.c:134:8: warning: Potential leak of memory
pointed to by 'path_list'ret = 0; ^
path_listis allocated inparse_path()but never freed.Signed-off-by Tom Rix <[email protected]>
Reviewed-by Mickaël Salaün <[email protected]>
Previous version:
https://lore.kernel.org/r/[email protected]
Quoted 20 lines
---
v2:
- Remove NULL ptr check--- samples/landlock/sandboxer.c | 1 + 1 file changed, 1 insertion(+)samples/landlock/sandboxer.c +1
-0@@ -134,6 +134,7 @@ static int populate_ruleset( ret =0 ; out_free_name: +free (path_list);free (env_path_name);return ret; }