[systemd-devel] [PATCH] fix memory leak when bailing out

Mauro Dreissig mukadr at gmail.com
Mon Dec 3 13:44:56 PST 2012


---
 src/modules-load/modules-load.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index e72e382..0492831 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -89,15 +89,19 @@ static int parse_proc_cmdline(void) {
                 if (startswith(word, "modules-load=")) {
 
                         r = add_modules(word + 13);
-                        if (r < 0)
+                        if (r < 0) {
+                                free(word);
                                 goto finish;
+                        }
 
                 } else if (startswith(word, "rd.modules-load=")) {
 
                         if (in_initrd()) {
                                 r = add_modules(word + 16);
-                                if (r < 0)
+                                if (r < 0) {
+                                        free(word);
                                         goto finish;
+                                }
                         }
 
                 }
-- 
1.7.11.7


More information about the systemd-devel mailing list