diff mbox series

[2/3] semodule_package: Close leaking fd

Message ID 20220401133549.122069-2-plautrba@redhat.com (mailing list archive)
State Accepted
Commit ac16531b5ab6
Headers show
Series [1/3] libsemanage: Fix USE_AFTER_FREE (CWE-672) in semanage_direct_get_module_info() | expand

Commit Message

Petr Lautrbach April 1, 2022, 1:35 p.m. UTC
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 semodule-utils/semodule_package/semodule_package.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/semodule-utils/semodule_package/semodule_package.c b/semodule-utils/semodule_package/semodule_package.c
index 3515234e36de..bc8584b51079 100644
--- a/semodule-utils/semodule_package/semodule_package.c
+++ b/semodule-utils/semodule_package/semodule_package.c
@@ -73,6 +73,7 @@  static int file_to_data(const char *path, char **data, size_t * len)
 		goto err;
 	}
 	if (!sb.st_size) {
+		close(fd);
 		*len = 0;
 		return 0;
 	}