From 6a425ff3a6aac8dcd663b5d7647e9b372ddee0b6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 23 Dec 2019 19:48:21 +0000 Subject: [PATCH] [Minor] Sync ffi defs --- src/libutil/mem_pool.c | 2 +- test/lua/unit/rfc2047.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c index df8c3cb07..d17c72bb8 100644 --- a/src/libutil/mem_pool.c +++ b/src/libutil/mem_pool.c @@ -332,7 +332,7 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, gint flags, const gchar *loc) struct rspamd_mempool_entry_point *entry = rspamd_mempool_get_entry (loc); gsize total_size; - if (size == 0) { + if (size == 0 && entry) { size = entry->cur_suggestion; } diff --git a/test/lua/unit/rfc2047.lua b/test/lua/unit/rfc2047.lua index 0b8baf624..6054c5ca2 100644 --- a/test/lua/unit/rfc2047.lua +++ b/test/lua/unit/rfc2047.lua @@ -29,7 +29,7 @@ context("RFC2047 decoding", function() ffi.cdef[[ const char * rspamd_mime_header_decode (void *pool, const char *in, size_t inlen); - void * rspamd_mempool_new_ (size_t sz, const char *name, const char *strloc); + void * rspamd_mempool_new_ (size_t sz, const char *name, int flags, const char *strloc); void rspamd_mempool_delete (void *pool); ]] @@ -46,7 +46,7 @@ context("RFC2047 decoding", function() {"=?windows-1251?B?xO7q8+zl7fIuc2NyLnV1ZQ==?=", "Документ.scr.uue"}, } - local pool = ffi.C.rspamd_mempool_new_(4096, "lua", "rfc2047.lua:49") + local pool = ffi.C.rspamd_mempool_new_(4096, "lua", 0, "rfc2047.lua:49") for _,c in ipairs(cases) do local res = ffi.C.rspamd_mime_header_decode(pool, c[1], #c[1]) @@ -60,7 +60,7 @@ context("RFC2047 decoding", function() end) test("Fuzz test for rfc2047 tokens", function() local util = require("rspamd_util") - local pool = ffi.C.rspamd_mempool_new_(4096, "lua", "rfc2047.lua:63") + local pool = ffi.C.rspamd_mempool_new_(4096, "lua", 0, "rfc2047.lua:63") local str = "Тест Тест Тест Тест Тест" for i = 0,1000 do -- 2.39.5