]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
conf: reset global pointers after parsing line
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 10 Jun 2020 13:28:17 +0000 (15:28 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 10 Jun 2020 13:36:40 +0000 (15:36 +0200)
Don't leave dangling pointers in CNF_ParseLine().

conf.c

diff --git a/conf.c b/conf.c
index 2a4473d557f7310bd59e99e122bdf21ea284db7d..406829f450d7f57b38cac104b45cf88e9ff5ee9e 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -491,8 +491,10 @@ CNF_ParseLine(const char *filename, int number, char *line)
   CPS_NormalizeLine(line);
 
   /* Skip blank lines */
-  if (!*line)
+  if (!*line) {
+    processed_file = NULL;
     return;
+  }
 
   /* We have a real line, now try to match commands */
   processed_command = command = line;
@@ -673,6 +675,8 @@ CNF_ParseLine(const char *filename, int number, char *line)
   } else {
     other_parse_error("Invalid command");
   }
+
+  processed_file = processed_command = NULL;
 }
 
 /* ================================================== */