dhcp/SOURCES/dhcp-replay_file_limit.patch
2021-09-09 15:59:48 +00:00

46 lines
1.5 KiB
Diff

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