diff mbox series

libselinux/utils: use correct error handling

Message ID 20241128153239.16472-1-cgoettsche@seltendoof.de (mailing list archive)
State New
Headers show
Series libselinux/utils: use correct error handling | expand

Commit Message

Christian Göttsche Nov. 28, 2024, 3:32 p.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Instead of returning directly goto the err label, which prints a message
and closes the opened file stream.

Found by clang-analyzer.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libselinux/utils/sefcontext_compile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c
index 23d31274..5d7ab301 100644
--- a/libselinux/utils/sefcontext_compile.c
+++ b/libselinux/utils/sefcontext_compile.c
@@ -471,7 +471,7 @@  static int write_binary_file(const struct saved_data *data, const struct sidtab
 	/* write context table */
 	rc = write_sidtab(bin_file, stab);
 	if (rc)
-		return rc;
+		goto err;
 
 	rc = write_spec_node(bin_file, do_write_precompregex, data->root, stab);
 	if (rc)