From: Vsevolod Stakhov Date: Mon, 4 May 2020 16:38:58 +0000 (+0100) Subject: [Minor] Allow to pre-allocate lua_text X-Git-Tag: 2.6~457 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0049b5f6ed22a256033b51922e6416ddb291a48d;p=rspamd.git [Minor] Allow to pre-allocate lua_text --- 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; }