philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-replay_file_limit.patch

45d60a
diff --git a/server/confpars.c b/server/confpars.c
45d60a
index d79489b..c20d618 100644
45d60a
--- a/server/confpars.c
45d60a
+++ b/server/confpars.c
45d60a
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
45d60a
 
45d60a
 	cfile = (struct parse *)0;
45d60a
 #if defined (TRACING)
45d60a
+	// No need to dmalloc huge memory region if we're not going to re-play
45d60a
+	if (!trace_playback()){
45d60a
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
45d60a
+		goto noreplay;
45d60a
+	};
45d60a
 	flen = lseek (file, (off_t)0, SEEK_END);
45d60a
 	if (flen < 0) {
45d60a
 	      boom:
45d60a
@@ -174,6 +179,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
45d60a
 #else
45d60a
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
45d60a
 #endif
45d60a
+      noreplay:
45d60a
 	if (status != ISC_R_SUCCESS || cfile == NULL)
45d60a
 		return status;
45d60a
 
45d60a
diff --git a/server/confpars.c b/server/confpars.c
45d60a
index 3aecd05..5be4ab1 100644
45d60a
--- a/server/confpars.c
45d60a
+++ b/server/confpars.c
45d60a
@@ -176,6 +176,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
45d60a
 	if (trace_record ())
45d60a
 		trace_write_packet (ttype, ulen + tflen + 1, dbuf, MDL);
45d60a
 	status = new_parse(&cfile, -1, fbuf, ulen, filename, 0); /* XXX */
45d60a
+	dfree(dbuf, MDL);
45d60a
 #else
45d60a
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
45d60a
 #endif
45d60a
@@ -188,9 +189,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
45d60a
 	else
45d60a
 		status = conf_file_subparse (cfile, group, group_type);
45d60a
 	end_parse (&cfile);
45d60a
-#if defined (TRACING)
45d60a
-	dfree (dbuf, MDL);
45d60a
-#endif
45d60a
 	return status;
45d60a
 }