This variable may be leaked in some error paths.

Signed-off-by: Nicolas Iooss <[email protected]>
---
 libselinux/src/label_db.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libselinux/src/label_db.c b/libselinux/src/label_db.c
index 1155bcc84031..c46d0a1de9a7 100644
--- a/libselinux/src/label_db.c
+++ b/libselinux/src/label_db.c
@@ -281,9 +281,12 @@ db_init(const struct selinux_opt *opts, unsigned nopts,
                free(catalog);
                return NULL;
        }
-       if (fstat(fileno(filp), &sb) < 0)
+       if (fstat(fileno(filp), &sb) < 0) {
+               free(catalog);
                return NULL;
+       }
        if (!S_ISREG(sb.st_mode)) {
+               free(catalog);
                errno = EINVAL;
                return NULL;
        }
-- 
2.11.0

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Reply via email to