philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-replay_file_limit.patch

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