Buffer c must be freeed when code detects a comment or empty string after
a strip. Otherwise no other variable definitions will be loaded.

fixes: 565d91fdf
fixes: https://bugzilla.novell.com/show_bug.cgi?id=793411#c13
---
 src/shared/util.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 969ef2b..4a75996 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -815,11 +815,17 @@ int load_env_file(const char *fname,
 
                 p = strstrip(c ? c : l);
 
-                if (!*p)
+                if (!*p) {
+                        free(c);
+                        c = NULL;
                         continue;
+                }
 
-                if (strchr(COMMENTS, *p))
+                if (strchr(COMMENTS, *p)) {
+                        free(c);
+                        c = NULL;
                         continue;
+                }
 
                 u = normalize_env_assignment(p);
                 if (!u)
-- 
1.7.10.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to