philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-replay_file_limit.patch

26a25c
diff --git a/server/confpars.c b/server/confpars.c
26a25c
index d79489b..c20d618 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
26a25c
+	if (!trace_playback()){
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:
26a25c
@@ -174,6 +179,7 @@ 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:
26a25c
 	if (status != ISC_R_SUCCESS || cfile == NULL)
26a25c
 		return status;
26a25c
 
26a25c
diff --git a/server/confpars.c b/server/confpars.c
26a25c
index 3aecd05..5be4ab1 100644
26a25c
--- a/server/confpars.c
26a25c
+++ b/server/confpars.c
26a25c
@@ -176,6 +176,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
26a25c
 	if (trace_record ())
26a25c
 		trace_write_packet (ttype, ulen + tflen + 1, dbuf, MDL);
26a25c
 	status = new_parse(&cfile, -1, fbuf, ulen, filename, 0); /* XXX */
26a25c
+	dfree(dbuf, MDL);
26a25c
 #else
26a25c
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
26a25c
 #endif
26a25c
@@ -188,9 +189,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
26a25c
 	else
26a25c
 		status = conf_file_subparse (cfile, group, group_type);
26a25c
 	end_parse (&cfile);
26a25c
-#if defined (TRACING)
26a25c
-	dfree (dbuf, MDL);
26a25c
-#endif
26a25c
 	return status;
26a25c
 }