b58c84c
commit 50c2b3ba8ce030a47b55dd707bb8a6ab20444a05
b58c84c
Author: Pavel Zhukov <pzhukov@redhat.com>
b58c84c
Date:   Thu Feb 21 10:44:06 2019 +0100
7c09728
b58c84c
    Load leases DB in non-replay mode only
7c09728
3ccf3c8
diff --git a/server/confpars.c b/server/confpars.c
b58c84c
index 2743979..6b61964 100644
3ccf3c8
--- a/server/confpars.c
3ccf3c8
+++ b/server/confpars.c
3ccf3c8
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 
3ccf3c8
 	cfile = (struct parse *)0;
3ccf3c8
 #if defined (TRACING)
3ccf3c8
+	// No need to dmalloc huge memory region if we're not going to re-play
b58c84c
+	if (!trace_record()){
3ccf3c8
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
3ccf3c8
+		goto noreplay;
3ccf3c8
+	};
3ccf3c8
 	flen = lseek (file, (off_t)0, SEEK_END);
3ccf3c8
 	if (flen < 0) {
3ccf3c8
 	      boom:
b58c84c
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
b58c84c
 	if (result != ulen)
b58c84c
 		log_fatal ("%s: short read of %d bytes instead of %d.",
b58c84c
 			   filename, ulen, result);
b58c84c
-	close (file);
b58c84c
       memfile:
b58c84c
 	/* If we're recording, write out the filename and file contents. */
3ccf3c8
 	if (trace_record ())
b58c84c
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 #else
3ccf3c8
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
3ccf3c8
 #endif
7c09728
+      noreplay:
b58c84c
+	if (!trace_playback())
b58c84c
+		close (file);
7c09728
 	if (status != ISC_R_SUCCESS || cfile == NULL)
7c09728
 		return status;
7c09728
 
b58c84c
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 		status = conf_file_subparse (cfile, group, group_type);
3ccf3c8
 	end_parse (&cfile);
b58c84c
 #if defined (TRACING)
3ccf3c8
-	dfree (dbuf, MDL);
b58c84c
+	if (trace_record())
b58c84c
+	    dfree (dbuf, MDL);
b58c84c
 #endif
3ccf3c8
 	return status;
3ccf3c8
 }