Blame SOURCES/0316-modules-load-fix-memory-leak.patch

17b0f1
From 3c3d3e3e040d980186fec05506018db2d24faa83 Mon Sep 17 00:00:00 2001
17b0f1
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
17b0f1
Date: Mon, 11 May 2015 15:37:47 -0300
17b0f1
Subject: [PATCH] modules-load: fix memory leak
17b0f1
17b0f1
=================================================================
17b0f1
==64281==ERROR: LeakSanitizer: detected memory leaks
17b0f1
17b0f1
Direct leak of 32 byte(s) in 1 object(s) allocated from:
17b0f1
    #0 0x7f623c961c4a in malloc (/usr/lib64/libasan.so.2+0x96c4a)
17b0f1
    #1 0x5651f79ad34e in malloc_multiply (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2134e)
17b0f1
    #2 0x5651f79b02d6 in strjoin (/home/crrodriguez/scm/systemd/systemd-modules-load+0x242d6)
17b0f1
    #3 0x5651f79be1f5 in files_add (/home/crrodriguez/scm/systemd/systemd-modules-load+0x321f5)
17b0f1
    #4 0x5651f79be6a3 in conf_files_list_strv_internal (/home/crrodriguez/scm/systemd/systemd-modules-load+0x326a3)
17b0f1
    #5 0x5651f79bea24 in conf_files_list_nulstr (/home/crrodriguez/scm/systemd/systemd-modules-load+0x32a24)
17b0f1
    #6 0x5651f79ad01a in main (/home/crrodriguez/scm/systemd/systemd-modules-load+0x2101a)
17b0f1
    #7 0x7f623c11586f in __libc_start_main (/lib64/libc.so.6+0x2086f)
17b0f1
17b0f1
SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
17b0f1
17b0f1
This happens due to the wrong cleanup attribute is used (free vs strv_free)
17b0f1
17b0f1
Cherry-picked from: 4df3277881cffcd3bc9a5238203d6af7e1fd960f
17b0f1
Related: #1331667
17b0f1
---
17b0f1
 src/modules-load/modules-load.c | 2 +-
17b0f1
 1 file changed, 1 insertion(+), 1 deletion(-)
17b0f1
17b0f1
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
17b0f1
index 5f678789ce..bab9246a3e 100644
17b0f1
--- a/src/modules-load/modules-load.c
17b0f1
+++ b/src/modules-load/modules-load.c
17b0f1
@@ -256,7 +256,7 @@ int main(int argc, char *argv[]) {
17b0f1
                 }
17b0f1
 
17b0f1
         } else {
17b0f1
-                _cleanup_free_ char **files = NULL;
17b0f1
+                _cleanup_strv_free_ char **files = NULL;
17b0f1
                 char **fn, **i;
17b0f1
 
17b0f1
                 STRV_FOREACH(i, arg_proc_cmdline_modules) {