Blame SOURCES/dhcp-replay_file_limit.patch

26a25c
diff --git a/server/confpars.c b/server/confpars.c
632e5b
index d79489b..2b1e393 100644
26a25c
--- a/server/confpars.c
26a25c
+++ b/server/confpars.c
26a25c
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
26a25c
 
26a25c
 	cfile = (struct parse *)0;
26a25c
 #if defined (TRACING)
26a25c
+	// No need to dmalloc huge memory region if we're not going to re-play
632e5b
+	if (!trace_record()){
26a25c
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
26a25c
+		goto noreplay;
26a25c
+	};
26a25c
 	flen = lseek (file, (off_t)0, SEEK_END);
26a25c
 	if (flen < 0) {
26a25c
 	      boom:
632e5b
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
632e5b
 	if (result != ulen)
632e5b
 		log_fatal ("%s: short read of %d bytes instead of %d.",
632e5b
 			   filename, ulen, result);
632e5b
-	close (file);
632e5b
       memfile:
632e5b
 	/* If we're recording, write out the filename and file contents. */
632e5b
 	if (trace_record ())
632e5b
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
26a25c
 #else
26a25c
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
26a25c
 #endif
26a25c
+      noreplay:
632e5b
+	if (!trace_playback())
632e5b
+		close (file);
26a25c
 	if (status != ISC_R_SUCCESS || cfile == NULL)
26a25c
 		return status;
26a25c
 
632e5b
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
26a25c
 		status = conf_file_subparse (cfile, group, group_type);
26a25c
 	end_parse (&cfile);
632e5b
 #if defined (TRACING)
26a25c
-	dfree (dbuf, MDL);
632e5b
+	if (trace_record())
632e5b
+	    dfree (dbuf, MDL);
632e5b
 #endif
26a25c
 	return status;
26a25c
 }