From 06156913c40a4c2eccb15ab81f1ee78f87a68792 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sat, 13 Feb 2016 16:43:08 +0100 Subject: Fix memory leak --- src/firejail/main.c | 10 ++++++++++ src/firejail/profile.c | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/firejail/main.c b/src/firejail/main.c index 2f64d2268..4882e29e6 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -1598,6 +1598,16 @@ int main(int argc, char **argv) { free(cfg.seccomp_list_errno); } #endif + if (cfg.profile) { + ProfileEntry *prf = cfg.profile; + while (prf != NULL) { + ProfileEntry *next = prf->next; + free(prf->data); + free(prf->link); + free(prf); + prf = next; + } + } myexit(0); diff --git a/src/firejail/profile.c b/src/firejail/profile.c index e0de69e5e..5acbbec38 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -533,6 +533,8 @@ void profile_read(const char *fname) { // verify syntax, exit in case of error if (profile_check_line(ptr, lineno, fname)) profile_add(ptr); + else + free(ptr); } fclose(fp); } -- cgit v1.2.3-54-g00ecf