Blame SOURCES/dhcp-replay_file_limit.patch

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