summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-04 17:38:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-04 18:07:18 +0100
commit0049b5f6ed22a256033b51922e6416ddb291a48d (patch)
treef79c13eb0df8cef874501a1cb24378dddddc6983 /src
parent6626734dbcc7d8877c60111eb26d8594d15df592 (diff)
downloadrspamd-0049b5f6ed22a256033b51922e6416ddb291a48d.tar.gz
rspamd-0049b5f6ed22a256033b51922e6416ddb291a48d.zip
[Minor] Allow to pre-allocate lua_text
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_text.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index e23eed8cb..2586b3302 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -198,7 +198,11 @@ lua_new_text (lua_State *L, const gchar *start, gsize len, gboolean own)
if (len > 0) {
storage = g_malloc (len);
- memcpy (storage, start, len);
+
+ if (start != NULL) {
+ memcpy (storage, start, len);
+ }
+
t->start = storage;
t->flags = RSPAMD_TEXT_FLAG_OWN;
}