aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:13:03 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-12 15:13:03 +0100
commitcdc100b748c784d1c8e55aee647dfed53b6df893 (patch)
treef718c29f9d57fd07e365536c76175b01020d1aec /src/libserver
parent2ca160e852d55eb549f6f78ca7e09cab2b13a0e6 (diff)
downloadrspamd-cdc100b748c784d1c8e55aee647dfed53b6df893.tar.gz
rspamd-cdc100b748c784d1c8e55aee647dfed53b6df893.zip
[Fix] Fix dynamic settings application
Issue: #769 Closes: #769
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/dynamic_cfg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 121158526..584590ed9 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -152,7 +152,6 @@ json_config_read_cb (gchar * chunk,
if (data->cur_data == NULL) {
jb = g_malloc0 (sizeof (*jb));
jb->cfg = pd->cfg;
- jb->buf = pd->buf;
data->cur_data = jb;
}
else {
@@ -161,7 +160,7 @@ json_config_read_cb (gchar * chunk,
if (jb->buf == NULL) {
/* Allocate memory for buffer */
- jb->buf = g_string_sized_new (BUFSIZ);
+ jb->buf = g_string_sized_new (MAX (len, BUFSIZ));
}
g_string_append_len (jb->buf, chunk, len);
@@ -179,6 +178,10 @@ json_config_fin_cb (struct map_cb_data *data)
if (data->prev_data) {
jb = data->prev_data;
/* Clean prev data */
+ if (jb->buf) {
+ g_string_free (jb->buf, TRUE);
+ }
+
g_free (jb);
}
@@ -190,6 +193,7 @@ json_config_fin_cb (struct map_cb_data *data)
msg_err ("no data read");
return;
}
+
if (jb->buf == NULL) {
msg_err ("no data read");
return;